2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
10 class FirstTVIE(InfoExtractor):
12 IE_DESC = 'Первый канал'
13 _VALID_URL = r'http://(?:www\.)?1tv\.ru/(?:[^/]+/)+(?P<id>.+)'
16 'url': 'http://www.1tv.ru/videoarchive/73390',
17 'md5': '777f525feeec4806130f4f764bc18a4f',
21 'title': 'Олимпийские канатные дороги',
22 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
23 'thumbnail': 're:^https?://.*\.(?:jpg|JPG)$',
28 'skip': 'Only works from Russia',
30 'url': 'http://www.1tv.ru/prj/inprivate/vypusk/35930',
31 'md5': 'a1b6b60d530ebcf8daacf4565762bbaf',
35 'title': 'Наедине со всеми. Людмила Сенчина',
36 'description': 'md5:89553aed1d641416001fe8d450f06cb9',
37 'thumbnail': 're:^https?://.*\.(?:jpg|JPG)$',
40 'skip': 'Only works from Russia',
43 def _real_extract(self, url):
44 video_id = self._match_id(url)
46 webpage = self._download_webpage(url, video_id, 'Downloading page')
48 video_url = self._html_search_regex(
49 r'''(?s)(?:jwplayer\('flashvideoportal_1'\)\.setup\({|var\s+playlistObj\s*=).*?'file'\s*:\s*'([^']+)'.*?}\);''',
52 title = self._html_search_regex(
53 [r'<div class="tv_translation">\s*<h1><a href="[^"]+">([^<]*)</a>',
54 r"'title'\s*:\s*'([^']+)'"], webpage, 'title')
55 description = self._html_search_regex(
56 r'<div class="descr">\s*<div> </div>\s*<p>([^<]*)</p></div>',
57 webpage, 'description', default=None) or self._html_search_meta(
58 'description', webpage, 'description')
60 thumbnail = self._og_search_thumbnail(webpage)
61 duration = self._og_search_property(
62 'video:duration', webpage,
63 'video duration', fatal=False)
65 like_count = self._html_search_regex(
66 r'title="Понравилось".*?/></label> \[(\d+)\]',
67 webpage, 'like count', default=None)
68 dislike_count = self._html_search_regex(
69 r'title="Не понравилось".*?/></label> \[(\d+)\]',
70 webpage, 'dislike count', default=None)
75 'thumbnail': thumbnail,
77 'description': description,
78 'duration': int_or_none(duration),
79 'like_count': int_or_none(like_count),
80 'dislike_count': int_or_none(dislike_count),