fix embed-player extractor
This commit is contained in:
parent
0ba69a77e1
commit
b9a3b64d48
@ -21,24 +21,28 @@ from ..utils import (
|
||||
|
||||
class ViceBaseIE(AdobePassIE):
|
||||
def _extract_preplay_video(self, url, locale, webpage):
|
||||
try:
|
||||
|
||||
prefetch_data = self._parse_json(self._search_regex(
|
||||
r'window\.__PREFETCH_DATA\s*=\s*({.*});',
|
||||
webpage, 'prefetch data'), None, fatal=False)
|
||||
if prefetch_data:
|
||||
if prefetch_data.get('data'):
|
||||
prefetch_data = prefetch_data.get('data')
|
||||
prefetch_data = prefetch_data.get('video')
|
||||
|
||||
video_id = prefetch_data.get('id')
|
||||
title = prefetch_data.get('title')
|
||||
is_locked = prefetch_data.get('locked') == '1' or prefetch_data.get('locked') == 'true'
|
||||
watch_hub_data = {}
|
||||
else:
|
||||
prefetch_data = {}
|
||||
watch_hub_data = extract_attributes(self._search_regex(
|
||||
r'(?s)(<watch-hub\s*.+?</watch-hub>)', webpage, 'watch hub'))
|
||||
video_id = watch_hub_data['vms-id']
|
||||
title = watch_hub_data['video-title']
|
||||
except:
|
||||
embed_player = extract_attributes(self._search_regex(
|
||||
r'(?s)(<embed-player\s*.+?</embed-player>)', webpage, 'embed player'))
|
||||
video_id = embed_player['vms-id']
|
||||
title = embed_player['video-title']
|
||||
watch_hub_data = {'thumbnail': embed_player.get('img'),
|
||||
'show-title': embed_player.get('show-title'),
|
||||
'channel-title': embed_player.get('channel-title'),
|
||||
'uploader': embed_player.get('channel-id')
|
||||
}
|
||||
is_locked = watch_hub_data.get('video-locked') == '1'
|
||||
|
||||
query = {}
|
||||
is_locked = watch_hub_data.get('video-locked') == '1'
|
||||
if is_locked:
|
||||
resource = self._get_mvpd_resource(
|
||||
'VICELAND', title, video_id,
|
||||
@ -86,8 +90,10 @@ class ViceBaseIE(AdobePassIE):
|
||||
'id': video_id,
|
||||
'title': title,
|
||||
'description': base.get('body') or base.get('display_body'),
|
||||
'thumbnail': watch_hub_data.get('cover-image') or watch_hub_data.get('thumbnail'),
|
||||
'duration': int_or_none(video_data.get('video_duration')) or parse_duration(watch_hub_data.get('video-duration')),
|
||||
'thumbnail': prefetch_data.get('thumbnail_url') or watch_hub_data.get('cover-image') or watch_hub_data.get(
|
||||
'thumbnail'),
|
||||
'duration': int_or_none(video_data.get('video_duration')) or parse_duration(
|
||||
watch_hub_data.get('video-duration')),
|
||||
'timestamp': int_or_none(video_data.get('created_at'), 1000),
|
||||
'age_limit': parse_age_limit(video_data.get('video_rating')),
|
||||
'series': video_data.get('show_title') or watch_hub_data.get('show-title'),
|
||||
@ -154,6 +160,9 @@ class ViceIE(ViceBaseIE):
|
||||
}, {
|
||||
'url': 'https://video.vice.com/en_us/video/pizza-show-trailer/56d8c9a54d286ed92f7f30e4',
|
||||
'only_matching': True,
|
||||
}, {
|
||||
'url': 'https://video.vice.com/en_us/embed/57f41d3556a0a80f54726060',
|
||||
'only_matching': True,
|
||||
}]
|
||||
_PREPLAY_HOST = 'video.vice'
|
||||
|
||||
@ -281,11 +290,11 @@ class ViceArticleIE(InfoExtractor):
|
||||
if youtube_url:
|
||||
return _url_res(youtube_url, 'Youtube')
|
||||
|
||||
try:
|
||||
if prefetch_data.get('embed_code'):
|
||||
video_url = self._html_search_regex(
|
||||
r'data-video-url="([^"]+)"',
|
||||
prefetch_data['embed_code'], 'video URL')
|
||||
except TypeError:
|
||||
else:
|
||||
video_url = self._html_search_regex(
|
||||
r'<\s*iframe\s*src=\s*"([^"]+)',
|
||||
body, 'video URL')
|
||||
|
Loading…
x
Reference in New Issue
Block a user