]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sportbox.py
54497c880ec2cc9cbfc5ff20756cbc19d4ee6c65
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class SportBoxEmbedIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://news\.sportbox\.ru/vdl/player(?:/[^/]+/|\?.*?\bn?id=)(?P<id>\d+)'
17 'url': 'http://news.sportbox.ru/vdl/player/ci/211355',
22 'thumbnail': r
're:^https?://.*\.jpg$',
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,
39 def _extract_urls(webpage
):
41 r
'<iframe[^>]+src="(https?://news\.sportbox\.ru/vdl/player[^"]+)"',
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
47 webpage
= self
._download
_webpage
(url
, video_id
)
49 wjplayer_data
= self
._parse
_json
(
51 r
'(?s)wjplayer\(({.+?})\);', webpage
, 'wjplayer settings'),
52 video_id
, transform_source
=js_to_json
)
55 for source
in wjplayer_data
['sources']:
56 src
= source
.get('src')
59 if determine_ext(src
) == 'm3u8':
60 formats
.extend(self
._extract
_m
3u8_formats
(
61 src
, video_id
, 'mp4', entry_protocol
='m3u8_native',
62 m3u8_id
='hls', fatal
=False))
67 self
._sort
_formats
(formats
)
69 view_count
= int_or_none(self
._search
_regex
(
70 r
'Просмотров\s*:\s*(\d+)', webpage
, 'view count', default
=None))
75 'thumbnail': wjplayer_data
.get('poster'),
76 'duration': int_or_none(wjplayer_data
.get('duration')),
77 'view_count': view_count
,