]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/gazeta.py
[youtube:comments] Add more options for limiting number of comments extracted (#1626)
[yt-dlp.git] / yt_dlp / extractor / gazeta.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4
5 from .common import InfoExtractor
6
7
8 class GazetaIE(InfoExtractor):
9 _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)'
10 _TESTS = [{
11 'url': 'http://www.gazeta.ru/video/main/zadaite_vopros_vladislavu_yurevichu.shtml',
12 'md5': 'd49c9bdc6e5a7888f27475dc215ee789',
13 'info_dict': {
14 'id': '205566',
15 'ext': 'mp4',
16 'title': '«70–80 процентов гражданских в Донецке на грани голода»',
17 'description': 'md5:38617526050bd17b234728e7f9620a71',
18 'thumbnail': r're:^https?://.*\.jpg',
19 },
20 'skip': 'video not found',
21 }, {
22 'url': 'http://www.gazeta.ru/lifestyle/video/2015/03/08/master-klass_krasivoi_byt._delaem_vesennii_makiyazh.shtml',
23 'only_matching': True,
24 }, {
25 'url': 'http://www.gazeta.ru/video/main/main/2015/06/22/platit_ili_ne_platit_po_isku_yukosa.shtml',
26 'md5': '37f19f78355eb2f4256ee1688359f24c',
27 'info_dict': {
28 'id': '252048',
29 'ext': 'mp4',
30 'title': '"Если по иску ЮКОСа придется платить, это будет большой удар по бюджету"',
31 },
32 'add_ie': ['EaglePlatform'],
33 }]
34
35 def _real_extract(self, url):
36 mobj = self._match_valid_url(url)
37
38 display_id = mobj.group('id')
39 embed_url = '%s?p=embed' % mobj.group('url')
40 embed_page = self._download_webpage(
41 embed_url, display_id, 'Downloading embed page')
42
43 video_id = self._search_regex(
44 r'<div[^>]*?class="eagleplayer"[^>]*?data-id="([^"]+)"', embed_page, 'video id')
45
46 return self.url_result(
47 'eagleplatform:gazeta.media.eagleplatform.com:%s' % video_id, 'EaglePlatform')