]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Add megavideoz.eu support.
authorJeff Buchbinder <jeff@ourexchange.net>
Fri, 16 Jan 2015 02:28:57 +0000 (21:28 -0500)
committerSergey M․ <dstftw@gmail.com>
Tue, 17 Mar 2015 14:33:03 +0000 (20:33 +0600)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/megavideozeu.py [new file with mode: 0644]

index 1bb3e1a1ce5042bd420a4f3fae1fb89ce2369ef5..5316af2d10576e765f4f3b0f6a31559c15275f36 100644 (file)
@@ -267,6 +267,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 (file)
index 0000000..e77b5f7
--- /dev/null
@@ -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<id>.*)(?:.*)'
+
+    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'<mediaid>([^<]+)', configpage, 'video id')
+        video_url = self._html_search_regex(
+            r'<file>([^<]+)', configpage, 'video URL')
+        title = self._html_search_regex(
+            r'<title><!\[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
+        }