From 2df665d4e74aaa57951aa713fa4a0ecd5f720ea1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Jan 2024 07:17:41 +0530 Subject: [PATCH] Propagate fix to wsj_free.recipe as well --- recipes/wsj_free.recipe | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/wsj_free.recipe b/recipes/wsj_free.recipe index a9656b808b..d8bb8ce016 100644 --- a/recipes/wsj_free.recipe +++ b/recipes/wsj_free.recipe @@ -74,7 +74,7 @@ class WSJ(BasicNewsRecipe): dict(attrs={'data-spotim-app':'conversation'}), dict(name=['button', 'svg', 'old-script', 'video']), dict(attrs={'aria-label':[ - 'Sponsored Offers', 'Listen To Article', 'What to Read Next', 'Utility Bar', + 'Sponsored Offers', 'Listen To Article', 'What to Read Next', 'Utility Bar', 'Conversation', 'List of Comments', 'Comment', 'JR More Articles' ]}), dict(attrs={'data-spot-im-class':['message-text', 'messages-list', 'message-view', 'conversation-root']}), @@ -92,7 +92,9 @@ class WSJ(BasicNewsRecipe): try: br.open(url) except Exception as e: - url = e.hdrs.get('location') + hdrs_location = e.hdrs.get('location') + if hdrs_location: + url = e.hdrs.get('location') raw = read_url(self.storage, 'https://archive.is/latest/' + url) pt = PersistentTemporaryFile('.html') pt.write(raw.encode('utf-8'))