From 14e10b2b6ec0d1ac3af36cc0458673ec89a88f03 Mon Sep 17 00:00:00 2001 From: pyed Date: Sun, 27 Oct 2013 01:19:38 +0300 Subject: [PATCH 1/4] [addanime] try to download HQ before normal --- youtube_dl/extractor/addanime.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/addanime.py b/youtube_dl/extractor/addanime.py index 82a785a19..adbda194a 100644 --- a/youtube_dl/extractor/addanime.py +++ b/youtube_dl/extractor/addanime.py @@ -17,8 +17,8 @@ class AddAnimeIE(InfoExtractor): IE_NAME = u'AddAnime' _TEST = { u'url': u'http://www.add-anime.net/watch_video.php?v=24MR3YO5SAS9', - u'file': u'24MR3YO5SAS9.flv', - u'md5': u'1036a0e0cd307b95bd8a8c3a5c8cfaf1', + u'file': u'24MR3YO5SAS9.mp4', + u'md5': u'3f8e232ad52163c87fa23897e736cb2c', u'info_dict': { u"description": u"One Piece 606", u"title": u"One Piece 606" @@ -60,8 +60,12 @@ def _real_extract(self, url): note=u'Confirming after redirect') webpage = self._download_webpage(url, video_id) - video_url = self._search_regex(r"var normal_video_file = '(.*?)';", + video_url = self._search_regex(r"var hq_video_file = '(.*?)';", webpage, u'video file URL') + if not video_url: # if there's no hq_video_file, get normal_video_file + video_url = self._search_regex(r"var normal_video_file = '(.*?)';", + webpage, u'video file URL') + video_extension = video_url[-3:] # mp4 or flv ? video_title = self._og_search_title(webpage) video_description = self._og_search_description(webpage) @@ -69,7 +73,7 @@ def _real_extract(self, url): '_type': 'video', 'id': video_id, 'url': video_url, - 'ext': 'flv', + 'ext': video_extension, 'title': video_title, 'description': video_description } From aee5e18c8f4c4360216ab27a2b1362a2ce24881e Mon Sep 17 00:00:00 2001 From: Abdulelah Alfntokh Date: Sun, 27 Oct 2013 13:36:43 +0300 Subject: [PATCH 2/4] [addanime] catch 'RegexNotFoundError' --- youtube_dl/extractor/addanime.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/addanime.py b/youtube_dl/extractor/addanime.py index adbda194a..45aac15c3 100644 --- a/youtube_dl/extractor/addanime.py +++ b/youtube_dl/extractor/addanime.py @@ -8,6 +8,7 @@ compat_urllib_parse_urlparse, ExtractorError, + RegexNotFoundError, ) @@ -60,11 +61,13 @@ def _real_extract(self, url): note=u'Confirming after redirect') webpage = self._download_webpage(url, video_id) - video_url = self._search_regex(r"var hq_video_file = '(.*?)';", - webpage, u'video file URL') - if not video_url: # if there's no hq_video_file, get normal_video_file + try: + video_url = self._search_regex(r"var hq_video_file = '(.*?)';", + webpage, u'video file URL') + except RegexNotFoundError: video_url = self._search_regex(r"var normal_video_file = '(.*?)';", webpage, u'video file URL') + video_extension = video_url[-3:] # mp4 or flv ? video_title = self._og_search_title(webpage) video_description = self._og_search_description(webpage) From 3e6a330d38e2bfce12a789c0f51c7d9754f4316e Mon Sep 17 00:00:00 2001 From: Abdulelah Alfntokh Date: Sun, 27 Oct 2013 13:51:26 +0300 Subject: [PATCH 3/4] [addanime] fix md5sum --- youtube_dl/extractor/addanime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/addanime.py b/youtube_dl/extractor/addanime.py index 45aac15c3..490b5af62 100644 --- a/youtube_dl/extractor/addanime.py +++ b/youtube_dl/extractor/addanime.py @@ -19,7 +19,7 @@ class AddAnimeIE(InfoExtractor): _TEST = { u'url': u'http://www.add-anime.net/watch_video.php?v=24MR3YO5SAS9', u'file': u'24MR3YO5SAS9.mp4', - u'md5': u'3f8e232ad52163c87fa23897e736cb2c', + u'md5': u'72954ea10bc979ab5e2eb288b21425a0', u'info_dict': { u"description": u"One Piece 606", u"title": u"One Piece 606" From 198e370f23d9e97b335d1c2603b9fc624817b701 Mon Sep 17 00:00:00 2001 From: Abdulelah Alfntokh Date: Sun, 27 Oct 2013 19:48:02 +0300 Subject: [PATCH 4/4] [addanime] better regex. --- youtube_dl/extractor/addanime.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/addanime.py b/youtube_dl/extractor/addanime.py index 490b5af62..465df8cf0 100644 --- a/youtube_dl/extractor/addanime.py +++ b/youtube_dl/extractor/addanime.py @@ -8,7 +8,6 @@ compat_urllib_parse_urlparse, ExtractorError, - RegexNotFoundError, ) @@ -61,12 +60,8 @@ def _real_extract(self, url): note=u'Confirming after redirect') webpage = self._download_webpage(url, video_id) - try: - video_url = self._search_regex(r"var hq_video_file = '(.*?)';", - webpage, u'video file URL') - except RegexNotFoundError: - video_url = self._search_regex(r"var normal_video_file = '(.*?)';", - webpage, u'video file URL') + video_url = self._search_regex(r"var (?:hq|normal)_video_file = '(.*?)';", + webpage, u'video file URL') video_extension = video_url[-3:] # mp4 or flv ? video_title = self._og_search_title(webpage)