projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7a5e7b3
)
[pbs] Add support for frontline videos (Closes #3414 #3405)
author
Sergey M․
<dstftw@gmail.com>
Sat, 2 Aug 2014 12:09:36 +0000
(19:09 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 2 Aug 2014 12:09:36 +0000
(19:09 +0700)
youtube_dl/extractor/pbs.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/pbs.py
b/youtube_dl/extractor/pbs.py
index 64cded70789249746a5e2b6604d86563a6ad499c..ec95d070411f97e1dad2fde881c9e5f847caafc8 100644
(file)
--- 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)
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')
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
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)
info_url = 'http://video.pbs.org/videoInfo/%s?format=json' % video_id
info = self._download_json(info_url, display_id)