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