Skip to content

Commit

Permalink
Merge pull request #11 from Cafeepy/patch-1
Browse files Browse the repository at this point in the history
Fix json.decoder.JSONDecodeError in extract.py
  • Loading branch information
H4KKR committed Nov 5, 2020
2 parents 2df3523 + 1998e8d commit 9a2b262
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pytube/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ def get_ytplayer_config(html: str) -> Any:
if function_match:
logger.debug("finished regex search, matched: %s", pattern)
yt_player_config = function_match.group(1)
return json.loads(yt_player_config)
try:
return json.loads(yt_player_config)
except:
pass

raise RegexMatchError(caller="get_ytplayer_config", pattern="config_patterns")

Expand Down

0 comments on commit 9a2b262

Please sign in to comment.