2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..utils import int_or_none
8 class FirstTVIE(InfoExtractor):
10 IE_DESC = 'Первый канал'
11 _VALID_URL = r'https?://(?:www\.)?1tv\.ru/(?:[^/]+/)+(?P<id>.+)'
14 'url': 'http://www.1tv.ru/videoarchive/73390',
15 'md5': '777f525feeec4806130f4f764bc18a4f',
19 'title': 'Олимпийские канатные дороги',
20 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
21 'thumbnail': 're:^https?://.*\.(?:jpg|JPG)$',
26 'skip': 'Only works from Russia',
28 'url': 'http://www.1tv.ru/prj/inprivate/vypusk/35930',
29 'md5': 'a1b6b60d530ebcf8daacf4565762bbaf',
33 'title': 'Наедине со всеми. Людмила Сенчина',
34 'description': 'md5:89553aed1d641416001fe8d450f06cb9',
35 'thumbnail': 're:^https?://.*\.(?:jpg|JPG)$',
38 'skip': 'Only works from Russia',
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
44 webpage = self._download_webpage(url, video_id, 'Downloading page')
46 video_url = self._html_search_regex(
47 r'''(?s)(?:jwplayer\('flashvideoportal_1'\)\.setup\({|var\s+playlistObj\s*=).*?'file'\s*:\s*'([^']+)'.*?}\);''',
50 title = self._html_search_regex(
51 [r'<div class="tv_translation">\s*<h1><a href="[^"]+">([^<]*)</a>',
52 r"'title'\s*:\s*'([^']+)'"], webpage, 'title')
53 description = self._html_search_regex(
54 r'<div class="descr">\s*<div> </div>\s*<p>([^<]*)</p></div>',
55 webpage, 'description', default=None) or self._html_search_meta(
56 'description', webpage, 'description')
58 thumbnail = self._og_search_thumbnail(webpage)
59 duration = self._og_search_property(
60 'video:duration', webpage,
61 'video duration', fatal=False)
63 like_count = self._html_search_regex(
64 r'title="Понравилось".*?/></label> \[(\d+)\]',
65 webpage, 'like count', default=None)
66 dislike_count = self._html_search_regex(
67 r'title="Не понравилось".*?/></label> \[(\d+)\]',
68 webpage, 'dislike count', default=None)
73 'thumbnail': thumbnail,
75 'description': description,
76 'duration': int_or_none(duration),
77 'like_count': int_or_none(like_count),
78 'dislike_count': int_or_none(dislike_count),