aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/pbs.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2014-08-02 19:09:36 +0700
committerSergey M․ <dstftw@gmail.com>2014-08-02 19:09:36 +0700
commit8d7d9d34521bcfa1b846964f404e8769d2e85ba0 (patch)
tree19fd2eb1528e16b383da525ec6df04b54fdc48a2 /youtube_dl/extractor/pbs.py
parent7a5e7b303c6186f01e475789de7ef8cc3f9eea94 (diff)
[pbs] Add support for frontline videos (Closes #3414 #3405)
Diffstat (limited to 'youtube_dl/extractor/pbs.py')
-rw-r--r--youtube_dl/extractor/pbs.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/youtube_dl/extractor/pbs.py b/youtube_dl/extractor/pbs.py
index 64cded707..ec95d0704 100644
--- a/youtube_dl/extractor/pbs.py
+++ b/youtube_dl/extractor/pbs.py
@@ -32,13 +32,21 @@ class PBSIE(InfoExtractor):
},
}
- def _real_extract(self, url):
+ def _extract_ids(self, url):
mobj = re.match(self._VALID_URL, url)
presumptive_id = mobj.group('presumptive_id')
display_id = presumptive_id
if presumptive_id:
webpage = self._download_webpage(url, display_id)
+
+ # frontline video embed
+ media_id = self._search_regex(
+ r"div\s*:\s*'videoembed'\s*,\s*mediaid\s*:\s*'(\d+)'",
+ webpage, 'frontline video ID', fatal=False, default=None)
+ if media_id:
+ return media_id, presumptive_id
+
url = self._search_regex(
r'<iframe\s+id=["\']partnerPlayer["\'].*?\s+src=["\'](.*?)["\']>',
webpage, 'player URL')
@@ -57,6 +65,11 @@ class PBSIE(InfoExtractor):
video_id = mobj.group('id')
display_id = video_id
+ return video_id, display_id
+
+ def _real_extract(self, url):
+ video_id, display_id = self._extract_ids(url)
+
info_url = 'http://video.pbs.org/videoInfo/%s?format=json' % video_id
info = self._download_json(info_url, display_id)