diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2015-04-29 00:01:09 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2015-04-29 00:22:17 +0800 |
commit | e70c7568c0226449190b57b988c1df10bf6508db (patch) | |
tree | 36747841709c6cd885d4e4da4cc057bcc9d8286d /youtube_dl/extractor/testtube.py | |
parent | 39b62db1160f5a4770348f1d01daeb0ce049c28c (diff) |
[testtube] Detect Youtube iframes (fixes #4867)
Diffstat (limited to 'youtube_dl/extractor/testtube.py')
-rw-r--r-- | youtube_dl/extractor/testtube.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/youtube_dl/extractor/testtube.py b/youtube_dl/extractor/testtube.py index 6a7b5e49d..cbada136c 100644 --- a/youtube_dl/extractor/testtube.py +++ b/youtube_dl/extractor/testtube.py @@ -22,12 +22,30 @@ class TestTubeIE(InfoExtractor): 'uploader': 'DNews', 'uploader_id': 'dnews', }, + }, { + 'url': 'https://testtube.com/iflscience/insane-jet-ski-flipping', + 'info_dict': { + 'id': 'fAGfJ4YjVus', + 'ext': 'mp4', + 'title': 'Flipping Jet-Ski Skills | Outrageous Acts of Science', + 'uploader': 'Science Channel', + 'uploader_id': 'ScienceChannel', + 'upload_date': '20150203', + 'description': 'md5:e61374030015bae1d2e22f096d4769d6', + } }] def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) + + youtube_url = self._html_search_regex( + r'<iframe[^>]+src="((?:https?:)?//www.youtube.com/embed/[^"]+)"', + webpage, 'youtube iframe', default=None) + if youtube_url: + return self.url_result(youtube_url, 'Youtube', video_id=display_id) + video_id = self._search_regex( r"player\.loadRevision3Item\('video_id',\s*([0-9]+)\);", webpage, 'video ID') |