aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/pbs.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-02-10 20:46:38 +0600
committerSergey M․ <dstftw@gmail.com>2016-02-10 20:46:38 +0600
commit7fcea295c59f3321c5a70cb8171e6d5de1f378e4 (patch)
tree02ff9fe009e6f5a59a74f76bc3f95be585c9e865 /youtube_dl/extractor/pbs.py
parentcc799437ea828af8ca74cd5ba7dcfaf763f6e960 (diff)
[pbs] Switch to portal player by default (Closes #8491)
Diffstat (limited to 'youtube_dl/extractor/pbs.py')
-rw-r--r--youtube_dl/extractor/pbs.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/youtube_dl/extractor/pbs.py b/youtube_dl/extractor/pbs.py
index 97e8ffc97..cbd1efea0 100644
--- a/youtube_dl/extractor/pbs.py
+++ b/youtube_dl/extractor/pbs.py
@@ -8,6 +8,7 @@ from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
+ js_to_json,
strip_jsonp,
unified_strdate,
US_RATINGS,
@@ -432,9 +433,20 @@ class PBSIE(InfoExtractor):
for vid_id in video_id]
return self.playlist_result(entries, display_id)
- info = self._download_json(
- 'http://player.pbs.org/videoInfo/%s?format=json&type=partner' % video_id,
- display_id)
+ player = self._download_webpage(
+ 'http://player.pbs.org/portalplayer/%s' % video_id, display_id)
+
+ info = self._parse_json(
+ self._search_regex(
+ r'(?s)PBS\.videoData\s*=\s*({.+?});\n',
+ player, 'video data', default='{}'),
+ display_id, transform_source=js_to_json, fatal=False)
+
+ # Fallback to old videoInfo API
+ if not info:
+ info = self._download_json(
+ 'http://player.pbs.org/videoInfo/%s?format=json&type=partner' % video_id,
+ display_id, 'Downloading video info JSON')
formats = []
for encoding_name in ('recommended_encoding', 'alternate_encoding'):