1 from .common
import InfoExtractor
10 class SportBoxIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:news\.sportbox|matchtv)\.ru/vdl/player(?:/[^/]+/|\?.*?\bn?id=)(?P<id>\d+)'
12 _EMBED_REGEX
= [r
'<iframe[^>]+src="(?P<url>https?://(?:news\.sportbox|matchtv)\.ru/vdl/player[^"]+)"']
14 'url': 'http://news.sportbox.ru/vdl/player/ci/211355',
18 'title': 'В Новороссийске прошел детский турнир «Поле славы боевой»',
19 'description': 'В Новороссийске прошел детский турнир «Поле славы боевой»',
20 'thumbnail': r
're:^https?://.*\.jpg$',
23 'timestamp': 1426237001,
24 'upload_date': '20150313',
28 'skip_download': True,
31 'url': 'http://news.sportbox.ru/vdl/player?nid=370908&only_player=1&autostart=false&playeri=2&height=340&width=580',
32 'only_matching': True,
34 'url': 'https://news.sportbox.ru/vdl/player/media/193095',
35 'only_matching': True,
37 'url': 'https://news.sportbox.ru/vdl/player/media/109158',
38 'only_matching': True,
40 'url': 'https://matchtv.ru/vdl/player/media/109158',
41 'only_matching': True,
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
47 webpage
= self
._download
_webpage
(url
, video_id
)
49 sources
= self
._parse
_json
(
51 r
'(?s)playerOptions\.sources(?:WithRes)?\s*=\s*(\[.+?\])\s*;\s*\n',
53 video_id
, transform_source
=js_to_json
)
56 for source
in sources
:
57 src
= source
.get('src')
60 if determine_ext(src
) == 'm3u8':
61 formats
.extend(self
._extract
_m
3u8_formats
(
62 src
, video_id
, 'mp4', entry_protocol
='m3u8_native',
63 m3u8_id
='hls', fatal
=False))
69 player
= self
._parse
_json
(
71 r
'(?s)playerOptions\s*=\s*({.+?})\s*;\s*\n', webpage
,
72 'player options', default
='{}'),
73 video_id
, transform_source
=js_to_json
)
74 media_id
= player
['mediaId']
76 info
= self
._search
_json
_ld
(webpage
, media_id
, default
={})
78 view_count
= int_or_none(self
._search
_regex
(
79 r
'Просмотров\s*:\s*(\d+)', webpage
, 'view count', default
=None))
81 return merge_dicts(info
, {
83 'title': self
._og
_search
_title
(webpage
, default
=None) or media_id
,
84 'thumbnail': player
.get('poster'),
85 'duration': int_or_none(player
.get('duration')),
86 'view_count': view_count
,