From fec2d97ca2f1aa8b64c24b28d8c63cab052e9db4 Mon Sep 17 00:00:00 2001 From: Jeff Buchbinder Date: Thu, 15 Jan 2015 21:28:57 -0500 Subject: [PATCH] Add megavideoz.eu support. --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/megavideozeu.py | 39 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 youtube_dl/extractor/megavideozeu.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 9e9e20589..6657695cb 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -274,6 +274,7 @@ from .macgamestore import MacGameStoreIE from .mailru import MailRuIE from .malemotion import MalemotionIE from .mdr import MDRIE +from .megavideozeu import MegavideozeuIE from .metacafe import MetacafeIE from .metacritic import MetacriticIE from .mgoon import MgoonIE diff --git a/youtube_dl/extractor/megavideozeu.py b/youtube_dl/extractor/megavideozeu.py new file mode 100644 index 000000000..e77b5f734 --- /dev/null +++ b/youtube_dl/extractor/megavideozeu.py @@ -0,0 +1,39 @@ +# encoding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + int_or_none, + parse_filesize, + unified_strdate, +) + + +class MegavideozeuIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?megavideoz\.eu/video/(?P.*)(?:.*)' + + def _real_extract(self, url): + tmp_video_id = self._match_id(url) + + webpage = self._download_webpage(url, tmp_video_id) + + config_php = self._html_search_regex( + r'var cnf = \'([^\']+)\'', webpage, 'config.php url') + + configpage = self._download_webpage(config_php, tmp_video_id) + + video_id = self._html_search_regex( + r'([^<]+)', configpage, 'video id') + video_url = self._html_search_regex( + r'([^<]+)', configpage, 'video URL') + title = self._html_search_regex( + r'<!\[CDATA\[([^\]]+)', configpage, 'title') + duration = int_or_none(self._html_search_regex( + r'<duration>([0-9]+)', configpage, 'duration', fatal=False)) + + return { + 'id': video_id, + 'url': video_url, + 'title': title, + 'duration': duration + }