From: Sergey M․ Date: Sat, 18 Apr 2015 22:08:29 +0000 (+0600) Subject: [megavideozeu] Rename extractor X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=cc9b9df0b680da1cf610da57fbf397d8ebd75e74;p=youtube-dl [megavideozeu] Rename extractor --- diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 6657695cb..1dabea7d6 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -274,7 +274,7 @@ from .macgamestore import MacGameStoreIE from .mailru import MailRuIE from .malemotion import MalemotionIE from .mdr import MDRIE -from .megavideozeu import MegavideozeuIE +from .megavideoz import MegaVideozIE from .metacafe import MetacafeIE from .metacritic import MetacriticIE from .mgoon import MgoonIE diff --git a/youtube_dl/extractor/megavideoz.py b/youtube_dl/extractor/megavideoz.py new file mode 100644 index 000000000..d80f3633e --- /dev/null +++ b/youtube_dl/extractor/megavideoz.py @@ -0,0 +1,52 @@ +# encoding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + float_or_none, + xpath_text, +) + + +class MegaVideozIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?megavideoz\.eu/video/(?P[^/]+)(?:/(?P[^/]+))?' + _TEST = { + 'url': 'http://megavideoz.eu/video/WM6UB919XMXH/SMPTE-Universal-Film-Leader', + 'info_dict': { + 'id': '48723', + 'display_id': 'SMPTE-Universal-Film-Leader', + 'ext': 'mp4', + 'title': 'SMPTE Universal Film Leader', + 'thumbnail': 're:https?://.*?\.jpg', + 'duration': 10.93, + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + display_id = mobj.group('display_id') or video_id + + webpage = self._download_webpage(url, display_id) + + config = self._download_xml( + self._search_regex( + r"var\s+cnf\s*=\s*'([^']+)'", webpage, 'cnf url'), + display_id) + + video_url = xpath_text(config, './file', 'video url', fatal=True) + title = xpath_text(config, './title', 'title', fatal=True) + thumbnail = xpath_text(config, './image', 'thumbnail') + duration = float_or_none(xpath_text(config, './duration', 'duration')) + video_id = xpath_text(config, './mediaid', 'video id') or video_id + + return { + 'id': video_id, + 'display_id': display_id, + 'url': video_url, + 'title': title, + 'thumbnail': thumbnail, + 'duration': duration + } diff --git a/youtube_dl/extractor/megavideozeu.py b/youtube_dl/extractor/megavideozeu.py deleted file mode 100644 index f98080caa..000000000 --- a/youtube_dl/extractor/megavideozeu.py +++ /dev/null @@ -1,52 +0,0 @@ -# encoding: utf-8 -from __future__ import unicode_literals - -import re - -from .common import InfoExtractor -from ..utils import ( - float_or_none, - xpath_text, -) - - -class MegavideozeuIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?megavideoz\.eu/video/(?P[^/]+)(?:/(?P[^/]+))?' - _TEST = { - 'url': 'http://megavideoz.eu/video/WM6UB919XMXH/SMPTE-Universal-Film-Leader', - 'info_dict': { - 'id': '48723', - 'display_id': 'SMPTE-Universal-Film-Leader', - 'ext': 'mp4', - 'title': 'SMPTE Universal Film Leader', - 'thumbnail': 're:https?://.*?\.jpg', - 'duration': 10.93, - } - } - - def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') - display_id = mobj.group('display_id') or video_id - - webpage = self._download_webpage(url, display_id) - - config = self._download_xml( - self._search_regex( - r"var\s+cnf\s*=\s*'([^']+)'", webpage, 'cnf url'), - display_id) - - video_url = xpath_text(config, './file', 'video url', fatal=True) - title = xpath_text(config, './title', 'title', fatal=True) - thumbnail = xpath_text(config, './image', 'thumbnail') - duration = float_or_none(xpath_text(config, './duration', 'duration')) - video_id = xpath_text(config, './mediaid', 'video id') or video_id - - return { - 'id': video_id, - 'display_id': display_id, - 'url': video_url, - 'title': title, - 'thumbnail': thumbnail, - 'duration': duration - }