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':