This commit is contained in:
Kovid Goyal 2025-07-29 14:49:07 +05:30
commit b1634c10d3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 10 deletions

View File

@ -175,15 +175,15 @@ class WSJ(BasicNewsRecipe):
d, m, y = dt.split('-') d, m, y = dt.split('-')
cu = f'https://www.wsj.com/public/resources/documents/WSJNewsPaper-{int(m)}-{int(d)}-{y}.jpg' cu = f'https://www.wsj.com/public/resources/documents/WSJNewsPaper-{int(m)}-{int(d)}-{y}.jpg'
else: else:
raw = br.open('https://wsjtodaysedition.cmail19.com/t/d-e-suujjg-thithlkhlr-r/') raw = br.open('https://frontpages.freedomforum.org/newspapers/wsj-The_Wall_Street_Journal')
soup = BeautifulSoup(raw.read()) soup = BeautifulSoup(raw.read())
cu = soup.find( cu = soup.find(
'img', 'img',
attrs={ attrs={
'class': 'responsive-img', 'alt': 'Front Page Image',
'src': lambda x: x and 'WSJNewsPaper' in x 'src': lambda x: x and x.endswith('front-page-large.jpg'),
} },
)['src'] )['src'].replace('-large', '-medium')
self.report_progress(1, _('Downloading cover from %s') % cu) self.report_progress(1, _('Downloading cover from %s') % cu)
with closing(br.open(cu, timeout=self.timeout)) as r: with closing(br.open(cu, timeout=self.timeout)) as r:
cdata = r.read() cdata = r.read()

View File

@ -135,15 +135,15 @@ class WSJ(BasicNewsRecipe):
from calibre import browser from calibre import browser
from calibre.utils.img import save_cover_data_to from calibre.utils.img import save_cover_data_to
br = browser() br = browser()
raw = br.open('https://wsjtodaysedition.cmail19.com/t/d-e-suujjg-thithlkhlr-r/') raw = br.open('https://frontpages.freedomforum.org/newspapers/wsj-The_Wall_Street_Journal')
soup = BeautifulSoup(raw.read()) soup = BeautifulSoup(raw.read())
cu = soup.find( cu = soup.find(
'img', 'img',
attrs={ attrs={
'class': 'responsive-img', 'alt': 'Front Page Image',
'src': lambda x: x and 'WSJNewsPaper' in x 'src': lambda x: x and x.endswith('front-page-large.jpg'),
} },
)['src'] )['src'].replace('-large', '-medium')
self.report_progress(1, _('Downloading cover from %s')%cu) self.report_progress(1, _('Downloading cover from %s')%cu)
with closing(br.open(cu, timeout=self.timeout)) as r: with closing(br.open(cu, timeout=self.timeout)) as r:
cdata = r.read() cdata = r.read()