3 from .common
import InfoExtractor
11 class WebcasterIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://bl\.webcaster\.pro/(?:quote|media)/start/free_(?P<id>[^/]+)'
14 # http://video.khl.ru/quotes/393859
15 'url': 'http://bl.webcaster.pro/quote/start/free_c8cefd240aa593681c8d068cff59f407_hd/q393859/eb173f99dd5f558674dae55f4ba6806d/1480289104?sr%3D105%26fa%3D1%26type_id%3D18',
16 'md5': '0c162f67443f30916ff1c89425dcd4cd',
18 'id': 'c8cefd240aa593681c8d068cff59f407_hd',
20 'title': 'Сибирь - Нефтехимик. Лучшие моменты первого периода',
21 'thumbnail': r
're:^https?://.*\.jpg$',
24 'url': 'http://bl.webcaster.pro/media/start/free_6246c7a4453ac4c42b4398f840d13100_hd/2_2991109016/e8d0d82587ef435480118f9f9c41db41/4635726126',
25 'only_matching': True,
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
31 video
= self
._download
_xml
(url
, video_id
)
33 title
= xpath_text(video
, './/event_name', 'event name', fatal
=True)
36 for format_id
in (None, 'noise'):
37 track_tag
= join_nonempty('track', format_id
, delim
='_')
38 for track
in video
.findall('.//iphone/%s' % track_tag
):
39 track_url
= track
.text
42 if determine_ext(track_url
) == 'm3u8':
43 m3u8_formats
= self
._extract
_m
3u8_formats
(
44 track_url
, video_id
, 'mp4',
45 entry_protocol
='m3u8_native',
46 m3u8_id
=join_nonempty('hls', format_id
, delim
='-'), fatal
=False)
47 for f
in m3u8_formats
:
49 'source_preference': 0 if format_id
== 'noise' else 1,
50 'format_note': track
.get('title'),
52 formats
.extend(m3u8_formats
)
54 thumbnail
= xpath_text(video
, './/image', 'thumbnail')
59 'thumbnail': thumbnail
,
64 class WebcasterFeedIE(InfoExtractor
):
65 _VALID_URL
= r
'https?://bl\.webcaster\.pro/feed/start/free_(?P<id>[^/]+)'
66 _EMBED_REGEX
= [r
'<(?:object|a[^>]+class=["\']webcaster
-player
["\'])[^>]+data(?:-config)?=(["\']).*?config
=(?P
<url
>https?
://bl\
.webcaster\
.pro
/feed
/start
/free_
.*?
)(?
:[?
&]|\
1)']
68 'url
': 'http
://bl
.webcaster
.pro
/feed
/start
/free_c8cefd240aa593681c8d068cff59f407_hd
/q393859
/eb173f99dd5f558674dae55f4ba6806d
/1480289104',
69 'only_matching
': True,
72 def _extract_from_webpage(self, url, webpage):
73 yield from super()._extract_from_webpage(url, webpage)
75 for secure in (True, False):
76 video_url = self._og_search_video_url(webpage, secure=secure, default=None)
79 r'config
=(?P
<url
>https?
://bl\
.webcaster\
.pro
/feed
/start
/free_
[^?
&=]+)',
82 yield self.url_result(mobj.group('url
'), self)
84 def _real_extract(self, url):
85 video_id = self._match_id(url)
87 feed = self._download_xml(url, video_id)
89 video_url = xpath_text(
90 feed, ('video_hd
', 'video
'), 'video url
', fatal=True)
92 return self.url_result(video_url, WebcasterIE.ie_key())