diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-01-08 17:50:46 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-01-08 18:03:29 +0100 |
commit | 92b065dc539649d29804ebe329c89de9503b7098 (patch) | |
tree | 98b5d5d8eb09b659cd558d45b22fdbb63fcaaeb2 /youtube_dl | |
parent | 9298d4e3df4b6237f4f9e4f37b9e55775c5e3c0c (diff) |
[tudou] Fix extraction
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/tudou.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/youtube_dl/extractor/tudou.py b/youtube_dl/extractor/tudou.py index 161e47624..c89de5ba4 100644 --- a/youtube_dl/extractor/tudou.py +++ b/youtube_dl/extractor/tudou.py @@ -9,7 +9,7 @@ from .common import InfoExtractor class TudouIE(InfoExtractor): - _VALID_URL = r'(?:http://)?(?:www\.)?tudou\.com/(?:listplay|programs|albumplay)/(?:view|(.+?))/(?:([^/]+)|([^/]+))(?:\.html)?' + _VALID_URL = r'https?://(?:www\.)?tudou\.com/(?:listplay|programs(?:/view)?|albumplay)/.*?/(?P<id>[^/?#]+?)(?:\.html)?/?(?:$|[?#])' _TESTS = [{ 'url': 'http://www.tudou.com/listplay/zzdE77v6Mmo/2xN2duXMxmw.html', 'md5': '140a49ed444bd22f93330985d8475fcb', @@ -27,13 +27,6 @@ class TudouIE(InfoExtractor): 'title': 'La Sylphide-Bolshoi-Ekaterina Krysanova & Vyacheslav Lopatin 2012', 'thumbnail': 're:^https?://.*\.jpg$', } - }, { - 'url': 'http://www.tudou.com/albumplay/TenTw_JgiPM/PzsAs5usU9A.html', - 'info_dict': { - 'title': 'todo.mp4', - }, - 'add_ie': ['Youku'], - 'skip': 'Only works from China' }] def _url_for_id(self, id, quality=None): @@ -45,8 +38,7 @@ class TudouIE(InfoExtractor): return final_url def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group(2) + video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) m = re.search(r'vcode:\s*[\'"](.+?)[\'"]', webpage) @@ -87,4 +79,9 @@ class TudouIE(InfoExtractor): } result.append(part_info) - return result + return { + '_type': 'multi_video', + 'entries': result, + 'id': video_id, + 'title': title, + } |