[sportbox] Fix extraction

This commit is contained in:
Alexey Trofimov 2018-10-26 15:00:55 +07:00 committed by Sergey M․
parent a1d1c63678
commit 4c237ab787
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -18,7 +18,7 @@ class SportBoxEmbedIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': '211355', 'id': '211355',
'ext': 'mp4', 'ext': 'mp4',
'title': '211355', 'title': 'В Новороссийске прошел детский турнир «Поле славы боевой»',
'thumbnail': r're:^https?://.*\.jpg$', 'thumbnail': r're:^https?://.*\.jpg$',
'duration': 292, 'duration': 292,
'view_count': int, 'view_count': int,
@ -48,9 +48,18 @@ class SportBoxEmbedIE(InfoExtractor):
wjplayer_data = self._parse_json( wjplayer_data = self._parse_json(
self._search_regex( self._search_regex(
r'(?s)wjplayer\(({.+?})\);', webpage, 'wjplayer settings'), r'(?s)var\s+playerOptions\s*=\s*({.+?});', webpage, 'wjplayer settings'),
video_id, transform_source=js_to_json) video_id, transform_source=js_to_json)
wjplayer_data['sources'] = self._parse_json(
self._search_regex(
r'(?s)playerOptions\.sources\s*=\s*(\[.+?\]);', webpage, 'wjplayer sources'),
video_id, transform_source=js_to_json)
title = self._html_search_meta(
['og:title', 'twitter:title'], webpage) or self._html_search_regex(
r'<title>(.+?)</title>', webpage, 'title', fatal=False) or video_id
formats = [] formats = []
for source in wjplayer_data['sources']: for source in wjplayer_data['sources']:
src = source.get('src') src = source.get('src')
@ -71,7 +80,7 @@ class SportBoxEmbedIE(InfoExtractor):
return { return {
'id': video_id, 'id': video_id,
'title': video_id, 'title': title,
'thumbnail': wjplayer_data.get('poster'), 'thumbnail': wjplayer_data.get('poster'),
'duration': int_or_none(wjplayer_data.get('duration')), 'duration': int_or_none(wjplayer_data.get('duration')),
'view_count': view_count, 'view_count': view_count,