2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..compat import compat_urlparse
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',
21 'title': 'В Новороссийске прошел детский турнир «Поле славы боевой»',
22 'thumbnail': r're:^https?://.*\.jpg$',
26 'skip_download': True,
29 'url': 'http://news.sportbox.ru/vdl/player?nid=370908&only_player=1&autostart=false&playeri=2&height=340&width=580',
30 'only_matching': True,
34 def _extract_urls(webpage):
36 r'<iframe[^>]+src="(https?://news\.sportbox\.ru/vdl/player[^"]+)"',
39 def _real_extract(self, url):
40 video_id = self._match_id(url)
42 webpage = self._download_webpage(url, video_id)
47 # desktop_advert_config contains complex Javascripts and we don't need it
48 return js_to_json(re.sub(r'desktop_advert_config.*', '', code))
50 jwplayer_data = self._parse_json(self._search_regex(
51 r'(?s)player\.setup\(({.+?})\);', webpage, 'jwplayer settings'), video_id,
52 transform_source=cleanup_js)
54 hls_url = jwplayer_data.get('hls_url')
56 formats.extend(self._extract_m3u8_formats(
57 hls_url, video_id, ext='mp4', m3u8_id='hls'))
59 rtsp_url = jwplayer_data.get('rtsp_url')
66 self._sort_formats(formats)
68 title = jwplayer_data['node_title']
69 thumbnail = jwplayer_data.get('image_url')
74 'thumbnail': thumbnail,