2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class KrasViewIE(InfoExtractor):
15 _VALID_URL = r'https?://krasview\.ru/(?:video|embed)/(?P<id>\d+)'
18 'url': 'http://krasview.ru/video/512228',
19 'md5': '3b91003cf85fc5db277870c8ebd98eae',
23 'title': 'Снег, лёд, заносы',
24 'description': 'Снято в городе Нягань, в Ханты-Мансийском автономном округе.',
26 'thumbnail': 're:^https?://.*\.jpg',
30 def _real_extract(self, url):
31 video_id = self._match_id(url)
33 webpage = self._download_webpage(url, video_id)
35 flashvars = json.loads(js_to_json(self._search_regex(
36 r'video_Init\(({.+?})', webpage, 'flashvars')))
38 video_url = flashvars['url']
39 title = self._og_search_title(webpage)
40 description = self._og_search_description(webpage, default=None)
41 thumbnail = flashvars.get('image') or self._og_search_thumbnail(webpage)
42 duration = int_or_none(flashvars.get('duration'))
43 width = int_or_none(self._og_search_property(
44 'video:width', webpage, 'video width', default=None))
45 height = int_or_none(self._og_search_property(
46 'video:height', webpage, 'video height', default=None))
52 'description': description,
53 'thumbnail': thumbnail,