about summary refs log tree commit diff
path: root/youtube_dl/extractor/gazeta.py
diff options
context:
space:
mode:
authorNaglis Jonaitis <njonaitis@gmail.com>2015-03-08 13:54:01 +0200
committerNaglis Jonaitis <njonaitis@gmail.com>2015-03-08 13:54:01 +0200
commit1132eae56d0f693b5dc55529d5cfadf32b32700d (patch)
tree7bca113d8ae260be26410b11a79ef9ec4a9feceb /youtube_dl/extractor/gazeta.py
parentd34e79492d1d9d9babf85af3737b90c4fe55eb42 (diff)
downloadyoutube-dl-1132eae56d0f693b5dc55529d5cfadf32b32700d.tar.gz
youtube-dl-1132eae56d0f693b5dc55529d5cfadf32b32700d.tar.xz
youtube-dl-1132eae56d0f693b5dc55529d5cfadf32b32700d.zip
[gazeta] Add new extractor (Closes #4222)
Diffstat (limited to 'youtube_dl/extractor/gazeta.py')
-rw-r--r--youtube_dl/extractor/gazeta.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/youtube_dl/extractor/gazeta.py b/youtube_dl/extractor/gazeta.py
new file mode 100644
index 000000000..3f9e58061
--- /dev/null
+++ b/youtube_dl/extractor/gazeta.py
@@ -0,0 +1,35 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+
+
+class GazetaIE(InfoExtractor):
+    _VALID_URL = r'(?P<url>https?://(?:www\.)?gazeta\.ru/(?:(?P<category>[^/]*)/)?video/(?:main/)?(?P<id>[A-Za-z0-9-_]+)\.s?html)'
+    _TEST = {
+        'url': 'http://www.gazeta.ru/video/main/zadaite_vopros_vladislavu_yurevichu.shtml',
+        'md5': 'd49c9bdc6e5a7888f27475dc215ee789',
+        'info_dict': {
+            'id': '205566',
+            'ext': 'mp4',
+            'title': '«70–80 процентов гражданских в Донецке на грани голода»',
+            'description': 'md5:38617526050bd17b234728e7f9620a71',
+            'thumbnail': 're:^https?://.*\.jpg',
+        },
+    }
+
+    def _real_extract(self, url):
+        mobj = re.match(self._VALID_URL, url)
+
+        display_id = mobj.group('id')
+        embed_url = '%s?p=embed' % mobj.group('url')
+        embed_page = self._download_webpage(
+            embed_url, display_id, 'Downloading embed page')
+
+        video_id = self._search_regex(
+            r'<div[^>]*?class="eagleplayer"[^>]*?data-id="([^"]+)"', embed_page, 'video id')
+
+        return self.url_result(
+            'eagleplatform:gazeta.media.eagleplatform.com:%s' % video_id, 'EaglePlatform')