mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[watchbox] Fix extraction (closes #17107)
This commit is contained in:
parent
6f2d82a5a0
commit
19b9de13c4
|
@ -10,6 +10,7 @@ from ..utils import (
|
||||||
js_to_json,
|
js_to_json,
|
||||||
strip_or_none,
|
strip_or_none,
|
||||||
try_get,
|
try_get,
|
||||||
|
unescapeHTML,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -67,12 +68,20 @@ class WatchBoxIE(InfoExtractor):
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
source = (self._parse_json(
|
player_config = self._parse_json(
|
||||||
|
self._search_regex(
|
||||||
|
r'data-player-conf=(["\'])(?P<data>{.+?})\1', webpage,
|
||||||
|
'player config', default='{}', group='data'),
|
||||||
|
video_id, transform_source=unescapeHTML, fatal=False)
|
||||||
|
|
||||||
|
if not player_config:
|
||||||
|
player_config = self._parse_json(
|
||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'playerConf\s*=\s*({.+?})\s*;', webpage, 'player config',
|
r'playerConf\s*=\s*({.+?})\s*;', webpage, 'player config',
|
||||||
default='{}'),
|
default='{}'),
|
||||||
video_id, transform_source=js_to_json,
|
video_id, transform_source=js_to_json, fatal=False) or {}
|
||||||
fatal=False) or {}).get('source') or {}
|
|
||||||
|
source = player_config.get('source') or {}
|
||||||
|
|
||||||
video_id = compat_str(source.get('videoId') or video_id)
|
video_id = compat_str(source.get('videoId') or video_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue