Update Boston Globe

This commit is contained in:
Kovid Goyal 2021-08-19 20:18:22 +05:30
parent 6104475f5d
commit 31569649a1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -60,9 +60,12 @@ comics_to_fetch = {
def extract_json(raw_html):
idx = raw_html.find('Fusion.contentCache={')
close_idx = raw_html.find('</script>', idx)
raw = raw_html[idx:close_idx].strip().rstrip(';')
raw = raw_html[idx:close_idx]
raw = raw[raw.find('{'):]
data = json.loads(raw)
idx = raw.find(';Fusion')
raw = raw[:idx]
# open('/t/raw.html', 'w').write(raw)
data = json.loads(raw, strict=False)
# open('/t/raw.json', 'w').write(json.dumps(data, indent=2))
return data