diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-03-09 03:01:28 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-03-09 03:01:28 +0100 |
commit | dcca5819675df1e9d9a1caf00af0f98bb2ce511c (patch) | |
tree | 47523d0851107978072ca6dd5c982dafe7abff47 /youtube_dl/extractor/gazeta.py | |
parent | d475b3384cd372d89c35b9b1c26499f1e9cc1915 (diff) | |
parent | dd7831fe94a0fb8270e7fa3699677c7476a5cd83 (diff) |
Merge remote-tracking branch 'origin/master'
Conflicts:
youtube_dl/YoutubeDL.py
Diffstat (limited to 'youtube_dl/extractor/gazeta.py')
-rw-r--r-- | youtube_dl/extractor/gazeta.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/youtube_dl/extractor/gazeta.py b/youtube_dl/extractor/gazeta.py new file mode 100644 index 000000000..ea32b621c --- /dev/null +++ b/youtube_dl/extractor/gazeta.py @@ -0,0 +1,38 @@ +# 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/(?:[^/]+/)?video/(?:(?:main|\d{4}/\d{2}/\d{2})/)?(?P<id>[A-Za-z0-9-_.]+)\.s?html)' + _TESTS = [{ + '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', + }, + }, { + 'url': 'http://www.gazeta.ru/lifestyle/video/2015/03/08/master-klass_krasivoi_byt._delaem_vesennii_makiyazh.shtml', + 'only_matching': True, + }] + + 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') |