NY Review of Books

This commit is contained in:
unkn0w7n 2024-03-02 09:46:48 +05:30
parent c0f1f6670d
commit d1f8cd255a
2 changed files with 12 additions and 2 deletions

View File

@ -62,7 +62,7 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
# Find cover # Find cover
cover = soup.find('img', attrs={'class':'border-light-gray'}) cover = soup.find('img', attrs={'class':'border-light-gray'})
if cover is not None: if cover is not None:
self.cover_url = absurl(cover['src']) self.cover_url = absurl(cover['data-lazy-src'])
self.log('Found cover at:', self.cover_url) self.log('Found cover at:', self.cover_url)
# Find date # Find date
@ -91,3 +91,8 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
'description': desc}) 'description': desc})
return [('Current Issue', articles)] return [('Current Issue', articles)]
def preprocess_html(self, soup):
for img in soup.findAll('img', attrs={'data-lazy-src':True}):
img['src'] = img['data-lazy-src']
return soup

View File

@ -52,7 +52,7 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
# Find cover # Find cover
cover = soup.find('img', attrs={'class':'border-light-gray'}) cover = soup.find('img', attrs={'class':'border-light-gray'})
if cover is not None: if cover is not None:
self.cover_url = absurl(cover['src']) self.cover_url = absurl(cover['data-lazy-src'])
self.log('Found cover at:', self.cover_url) self.log('Found cover at:', self.cover_url)
# Find date # Find date
@ -81,3 +81,8 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
'description': desc}) 'description': desc})
return [('Current Issue', articles)] return [('Current Issue', articles)]
def preprocess_html(self, soup):
for img in soup.findAll('img', attrs={'data-lazy-src':True}):
img['src'] = img['data-lazy-src']
return soup