From 6a88069f0192c4a01ef3709f49a6aca3e5aa05b1 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Sun, 10 Mar 2024 09:50:28 +0530 Subject: [PATCH] Update natgeomag.recipe --- recipes/natgeomag.recipe | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/recipes/natgeomag.recipe b/recipes/natgeomag.recipe index 5f3aaee5eb..4e5fc6bb4d 100644 --- a/recipes/natgeomag.recipe +++ b/recipes/natgeomag.recipe @@ -23,8 +23,10 @@ def classes(classes): def extract_json(raw): s = raw.find("window['__natgeo__']") script = raw[s:raw.find('', s)] - return json.loads( - script[script.find('{'):].rstrip(';'))['page']['content']['article'] + data = json.loads(script[script.find('{'):].rstrip(';'))['page']['content'] + if 'article' in data: + return data['article'] + return data['prismarticle'] def parse_contributors(grp): @@ -36,16 +38,17 @@ def parse_contributors(grp): def parse_lead_image(media): - if 'dsc' in media['image']: - yield '