aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2016-08-12 08:38:06 +0100
committerRemita Amine <remitamine@gmail.com>2016-08-12 08:38:06 +0100
commit3cddb8d6a776b09afd7f50772fa30cb536b1149a (patch)
tree3b9c9bbb14095103f7d2469139ae94ec1c7f7ca8
parent990d533ee4a33f8c59921a4152817ff4835a974f (diff)
[pbs] check all http formats and remove unnecessary request
- some of the quality that not reported in the documentation are available(4500k, 6500k) - the videoInfo request doesn't work for a long time
-rw-r--r--youtube_dl/extractor/pbs.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/youtube_dl/extractor/pbs.py b/youtube_dl/extractor/pbs.py
index f6f423597..6e2ef0fba 100644
--- a/youtube_dl/extractor/pbs.py
+++ b/youtube_dl/extractor/pbs.py
@@ -448,17 +448,6 @@ class PBSIE(InfoExtractor):
redirects.append(redirect)
redirect_urls.add(redirect_url)
- try:
- video_info = self._download_json(
- 'http://player.pbs.org/videoInfo/%s?format=json&type=partner' % video_id,
- display_id, 'Downloading video info JSON')
- extract_redirect_urls(video_info)
- info = video_info
- except ExtractorError as e:
- # videoInfo API may not work for some videos
- if not isinstance(e.cause, compat_HTTPError) or e.cause.code != 404:
- raise
-
# Player pages may also serve different qualities
for page in ('widget/partnerplayer', 'portalplayer'):
player = self._download_webpage(
@@ -511,12 +500,12 @@ class PBSIE(InfoExtractor):
formats))
if http_url:
for m3u8_format in m3u8_formats:
- bitrate = self._search_regex(r'(\d+k)', m3u8_format['url'], 'bitrate', default=None)
+ bitrate = self._search_regex(r'(\d+)k', m3u8_format['url'], 'bitrate', default=None)
# extract only the formats that we know that they will be available as http format.
# https://projects.pbs.org/confluence/display/coveapi/COVE+Video+Specifications
- if not bitrate or bitrate not in ('400k', '800k', '1200k', '2500k'):
+ if not bitrate or int(bitrate) < 400:
continue
- f_url = re.sub(r'\d+k|baseline', bitrate, http_url)
+ f_url = re.sub(r'\d+k|baseline', bitrate + 'k', http_url)
# This may produce invalid links sometimes (e.g.
# http://www.pbs.org/wgbh/frontline/film/suicide-plan)
if not self._is_valid_url(f_url, display_id, 'http-%s video' % bitrate):