From 51663c3d277a0f446c36141ab3224230cb13b6c2 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Sat, 30 Sep 2023 21:56:31 +0530 Subject: [PATCH 1/3] Update natgeomag.recipe fix missing images --- recipes/natgeomag.recipe | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/recipes/natgeomag.recipe b/recipes/natgeomag.recipe index bfe52c8f4d..926e0429ea 100644 --- a/recipes/natgeomag.recipe +++ b/recipes/natgeomag.recipe @@ -54,6 +54,16 @@ def parse_body(item): elif c.get('cmsType') == 'image': for line in parse_lead_image(c): yield line + elif c.get('cmsType') == 'imagegroup': + for imgs in c['images']: + for line in parse_lead_image(imgs): + yield line + elif c.get('cmsType') == 'pullquote': + if 'quote' in c: + yield '
' + c['quote'] + "" + elif c.get('cmsType') == 'editorsNote': + if 'note' in c: + yield '
' + c['note'] + "" else: if c['mrkup'].strip().startswith('<'): yield c['mrkup'] @@ -88,6 +98,10 @@ def article_parse(data): continue for mod in frm.get('mods', ()): for edg in mod.get('edgs', ()): + if edg.get('cmsType') == 'ImmersiveLeadTile': + if 'image' in edg.get('cmsImage', {}): + for line in parse_lead_image(edg['cmsImage']): + yield line if edg.get('cmsType') == 'ArticleBodyTile': for line in parse_article(edg): yield line From dc586547cef6bf155035405f0944ba22377ac003 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Sat, 30 Sep 2023 22:09:00 +0530 Subject: [PATCH 2/3] similar changes to natgeo --- recipes/natgeo.recipe | 14 ++++++++++++++ recipes/natgeohis.recipe | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/recipes/natgeo.recipe b/recipes/natgeo.recipe index 5d2c89551b..e0fa1844ae 100644 --- a/recipes/natgeo.recipe +++ b/recipes/natgeo.recipe @@ -53,6 +53,16 @@ def parse_body(item): elif c.get('cmsType') == 'image': for line in parse_lead_image(c): yield line + elif c.get('cmsType') == 'imagegroup': + for imgs in c['images']: + for line in parse_lead_image(imgs): + yield line + elif c.get('cmsType') == 'pullquote': + if 'quote' in c: + yield '
' + c['quote'] + "" + elif c.get('cmsType') == 'editorsNote': + if 'note' in c: + yield '
' + c['note'] + "" else: if c['mrkup'].strip().startswith('<'): yield c['mrkup'] @@ -87,6 +97,10 @@ def article_parse(data): continue for mod in frm.get('mods', ()): for edg in mod.get('edgs', ()): + if edg.get('cmsType') == 'ImmersiveLeadTile': + if 'image' in edg.get('cmsImage', {}): + for line in parse_lead_image(edg['cmsImage']): + yield line if edg.get('cmsType') == 'ArticleBodyTile': for line in parse_article(edg): yield line diff --git a/recipes/natgeohis.recipe b/recipes/natgeohis.recipe index c620b4a5a7..f219b5ec5d 100644 --- a/recipes/natgeohis.recipe +++ b/recipes/natgeohis.recipe @@ -52,6 +52,16 @@ def parse_body(item): elif c.get('cmsType') == 'image': for line in parse_lead_image(c): yield line + elif c.get('cmsType') == 'imagegroup': + for imgs in c['images']: + for line in parse_lead_image(imgs): + yield line + elif c.get('cmsType') == 'pullquote': + if 'quote' in c: + yield '
' + c['quote'] + "" + elif c.get('cmsType') == 'editorsNote': + if 'note' in c: + yield '
' + c['note'] + "" else: if c['mrkup'].strip().startswith('<'): yield c['mrkup'] @@ -86,6 +96,10 @@ def article_parse(data): continue for mod in frm.get('mods', ()): for edg in mod.get('edgs', ()): + if edg.get('cmsType') == 'ImmersiveLeadTile': + if 'image' in edg.get('cmsImage', {}): + for line in parse_lead_image(edg['cmsImage']): + yield line if edg.get('cmsType') == 'ArticleBodyTile': for line in parse_article(edg): yield line From bd9cd519f6679c29f47ee681ae3783cdd18f6574 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Sat, 30 Sep 2023 23:07:41 +0530 Subject: [PATCH 3/3] ... --- recipes/natgeo.recipe | 6 +++--- recipes/natgeohis.recipe | 6 +++--- recipes/natgeomag.recipe | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/recipes/natgeo.recipe b/recipes/natgeo.recipe index e0fa1844ae..91201f5c33 100644 --- a/recipes/natgeo.recipe +++ b/recipes/natgeo.recipe @@ -48,7 +48,7 @@ def parse_body(item): if item.get('type') == 'inline': if c.get('cmsType') == 'listicle': if 'title' in c: - yield '
' + c['quote'] + "" + yield '
' + c['quote'] + '' elif c.get('cmsType') == 'editorsNote': if 'note' in c: - yield '
' + c['note'] + "" + yield '
' + c['note'] + '' else: if c['mrkup'].strip().startswith('<'): yield c['mrkup'] diff --git a/recipes/natgeohis.recipe b/recipes/natgeohis.recipe index f219b5ec5d..c4310c872c 100644 --- a/recipes/natgeohis.recipe +++ b/recipes/natgeohis.recipe @@ -47,7 +47,7 @@ def parse_body(item): if item.get('type') == 'inline': if c.get('cmsType') == 'listicle': if 'title' in c: - yield '
' + c['quote'] + "" + yield '
' + c['quote'] + '' elif c.get('cmsType') == 'editorsNote': if 'note' in c: - yield '
' + c['note'] + "" + yield '
' + c['note'] + '' else: if c['mrkup'].strip().startswith('<'): yield c['mrkup'] diff --git a/recipes/natgeomag.recipe b/recipes/natgeomag.recipe index 926e0429ea..e5fd4ec031 100644 --- a/recipes/natgeomag.recipe +++ b/recipes/natgeomag.recipe @@ -49,7 +49,7 @@ def parse_body(item): if item.get('type') == 'inline': if c.get('cmsType') == 'listicle': if 'title' in c: - yield '
' + c['quote'] + "" + yield '
' + c['quote'] + '' elif c.get('cmsType') == 'editorsNote': if 'note' in c: - yield '
' + c['note'] + "" + yield '
' + c['note'] + '' else: if c['mrkup'].strip().startswith('<'): yield c['mrkup']