Skip to content

Commit

Permalink
[watchbox] Fix extraction (closes #17107)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey M․ committed Jul 30, 2018
1 parent 6f2d82a commit 19b9de1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions youtube_dl/extractor/watchbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
js_to_json,
strip_or_none,
try_get,
unescapeHTML,
unified_timestamp,
)

Expand Down Expand Up @@ -67,12 +68,20 @@ def _real_extract(self, url):

webpage = self._download_webpage(url, video_id)

source = (self._parse_json(
player_config = self._parse_json(
self._search_regex(
r'playerConf\s*=\s*({.+?})\s*;', webpage, 'player config',
default='{}'),
video_id, transform_source=js_to_json,
fatal=False) or {}).get('source') or {}
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(
r'playerConf\s*=\s*({.+?})\s*;', webpage, 'player config',
default='{}'),
video_id, transform_source=js_to_json, fatal=False) or {}

source = player_config.get('source') or {}

video_id = compat_str(source.get('videoId') or video_id)

Expand Down

0 comments on commit 19b9de1

Please sign in to comment.