Propagate fix to wsj_free.recipe as well

This commit is contained in:
Kovid Goyal 2024-01-18 07:17:41 +05:30
parent 9b5cd1e134
commit 2df665d4e7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -74,7 +74,7 @@ class WSJ(BasicNewsRecipe):
dict(attrs={'data-spotim-app':'conversation'}), dict(attrs={'data-spotim-app':'conversation'}),
dict(name=['button', 'svg', 'old-script', 'video']), dict(name=['button', 'svg', 'old-script', 'video']),
dict(attrs={'aria-label':[ 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' 'Conversation', 'List of Comments', 'Comment', 'JR More Articles'
]}), ]}),
dict(attrs={'data-spot-im-class':['message-text', 'messages-list', 'message-view', 'conversation-root']}), dict(attrs={'data-spot-im-class':['message-text', 'messages-list', 'message-view', 'conversation-root']}),
@ -92,7 +92,9 @@ class WSJ(BasicNewsRecipe):
try: try:
br.open(url) br.open(url)
except Exception as e: 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) raw = read_url(self.storage, 'https://archive.is/latest/' + url)
pt = PersistentTemporaryFile('.html') pt = PersistentTemporaryFile('.html')
pt.write(raw.encode('utf-8')) pt.write(raw.encode('utf-8'))