From a099a545226fd1dc4c5d60b6ad603b313d11e3a5 Mon Sep 17 00:00:00 2001 From: idle sign Date: Sun, 5 Nov 2017 00:25:52 +0700 Subject: [PATCH 1/2] [allmovie] Add new extractor --- youtube_dl/extractor/allmovie.py | 46 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 47 insertions(+) create mode 100644 youtube_dl/extractor/allmovie.py diff --git a/youtube_dl/extractor/allmovie.py b/youtube_dl/extractor/allmovie.py new file mode 100644 index 000000000..dfe3ea7a0 --- /dev/null +++ b/youtube_dl/extractor/allmovie.py @@ -0,0 +1,46 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class AllmovieIE(InfoExtractor): + """Information extractor for allmovie.tv + + Test with: + python test/test_download.py TestDownload.test_Allmovie + + """ + _VALID_URL = r'http://allmovie\.tv/video/.+-(?P\d+)\.html' + + _TEST = { + 'url': 'http://allmovie.tv/video/vesti-v-subbotu-28-10-2017-17255.html', + 'md5': '5e9a21314b8dfd472c1a9cd61c610dd6', + 'info_dict': { + 'id': '17255', + 'ext': 'mp4', + 'title': 'Вести в субботу 28.10.2017', + 'description': 'Вести в субботу 28.10.2017', + 'thumbnail': 'http://allmovie.tv/upload/video/images/small/1d/d7/1dd757d37eb1431f541839d30371d436.jpg', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + + page_info = self._download_webpage(url, video_id, note='Downloading info page ...') + + page_player = self._download_webpage( + 'http://allmovie.tv/video/show_player/%s' % video_id, video_id, + headers={'X-Requested-With': 'XMLHttpRequest'}, + note='Downloading player page ...') + + video_url = self._search_regex(r'source src="([^"]+)"', page_player, 'video URL') + + return { + 'id': video_id, + 'title': self._og_search_title(page_info), + 'description': self._og_search_description(page_info), + 'thumbnail': self._og_search_thumbnail(page_info), + 'url': video_url, + } diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 92f7e9027..b0cf316af 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -34,6 +34,7 @@ from .aenetworks import ( from .afreecatv import AfreecaTVIE from .airmozilla import AirMozillaIE from .aljazeera import AlJazeeraIE +from .allmovie import AllmovieIE from .alphaporno import AlphaPornoIE from .amcnetworks import AMCNetworksIE from .americastestkitchen import AmericasTestKitchenIE From b0a9114e595e4c71766cefbb1cd7c75c334b13c2 Mon Sep 17 00:00:00 2001 From: idle sign Date: Sun, 13 May 2018 11:25:52 +0700 Subject: [PATCH 2/2] [allmovie] Add .pro domain support. --- youtube_dl/extractor/allmovie.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/allmovie.py b/youtube_dl/extractor/allmovie.py index dfe3ea7a0..3e67fcb48 100644 --- a/youtube_dl/extractor/allmovie.py +++ b/youtube_dl/extractor/allmovie.py @@ -1,17 +1,23 @@ # coding: utf-8 from __future__ import unicode_literals +try: + from urllib.parse import urlparse + +except ImportError: # py2 + from urlparse import urlparse + from .common import InfoExtractor class AllmovieIE(InfoExtractor): - """Information extractor for allmovie.tv + """Information extractor for allmovie. Test with: python test/test_download.py TestDownload.test_Allmovie """ - _VALID_URL = r'http://allmovie\.tv/video/.+-(?P\d+)\.html' + _VALID_URL = r'http://allmovie\.(tv|pro)/video/.+-(?P\d+)\.html' _TEST = { 'url': 'http://allmovie.tv/video/vesti-v-subbotu-28-10-2017-17255.html', @@ -30,8 +36,10 @@ class AllmovieIE(InfoExtractor): page_info = self._download_webpage(url, video_id, note='Downloading info page ...') + host = urlparse(url).hostname + page_player = self._download_webpage( - 'http://allmovie.tv/video/show_player/%s' % video_id, video_id, + 'http://%s/video/show_player/%s' % (host, video_id), video_id, headers={'X-Requested-With': 'XMLHttpRequest'}, note='Downloading player page ...')