]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/krasview.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / krasview.py
CommitLineData
8944ec01 1import json
8944ec01
S
2
3from .common import InfoExtractor
4from ..utils import (
5 int_or_none,
1e108029 6 js_to_json,
8944ec01
S
7)
8
9
10class KrasViewIE(InfoExtractor):
df773c3d 11 _WORKING = False
8944ec01 12 IE_DESC = 'Красвью'
1e108029 13 _VALID_URL = r'https?://krasview\.ru/(?:video|embed)/(?P<id>\d+)'
8944ec01
S
14
15 _TEST = {
16 'url': 'http://krasview.ru/video/512228',
17 'md5': '3b91003cf85fc5db277870c8ebd98eae',
18 'info_dict': {
19 'id': '512228',
20 'ext': 'mp4',
21 'title': 'Снег, лёд, заносы',
22 'description': 'Снято в городе Нягань, в Ханты-Мансийском автономном округе.',
23 'duration': 27,
ec85ded8 24 'thumbnail': r're:^https?://.*\.jpg',
8944ec01 25 },
ebbf078c
S
26 'params': {
27 'skip_download': 'Not accessible from Travis CI server',
28 },
8944ec01
S
29 }
30
31 def _real_extract(self, url):
1e108029 32 video_id = self._match_id(url)
8944ec01
S
33
34 webpage = self._download_webpage(url, video_id)
35
1e108029
S
36 flashvars = json.loads(js_to_json(self._search_regex(
37 r'video_Init\(({.+?})', webpage, 'flashvars')))
8944ec01
S
38
39 video_url = flashvars['url']
1e108029
S
40 title = self._og_search_title(webpage)
41 description = self._og_search_description(webpage, default=None)
42 thumbnail = flashvars.get('image') or self._og_search_thumbnail(webpage)
43 duration = int_or_none(flashvars.get('duration'))
2c2c06e3
S
44 width = int_or_none(self._og_search_property(
45 'video:width', webpage, 'video width', default=None))
46 height = int_or_none(self._og_search_property(
47 'video:height', webpage, 'video height', default=None))
8944ec01
S
48
49 return {
50 'id': video_id,
51 'url': video_url,
52 'title': title,
53 'description': description,
54 'thumbnail': thumbnail,
55 'duration': duration,
8944ec01
S
56 'width': width,
57 'height': height,
58 }