1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-06-26 05:39:34 +00:00

Fix json.decoder.JSONDecodeError: Extra data

Fix an error that occurs when `webpage` contains a JSON with multiple records.
This commit is contained in:
Trigus42 2021-09-01 16:34:36 +02:00
parent a803582717
commit 6d88c72317

View file

@ -430,7 +430,10 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
if note_m:
raise ExtractorError(note_m)
mobj = re.search(r'Page\.messaging_box_controller\.addItems\(\[(?P<msg>{.+?})\]\)', webpage)
mobj = re.search(
r'Page\.messaging_box_controller\.addItems\(\[(?P<msg>{(?!.*},{).+?})\]\)',
webpage)
if mobj:
msg = json.loads(mobj.group('msg'))
if msg.get('type') == 'error':