mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update mit_technology_review.recipe
Fix cover.
This commit is contained in:
parent
a1a8c92d5e
commit
8228f8c4b2
@ -10,7 +10,7 @@ technologyreview.com
|
||||
'''
|
||||
from calibre.web.feeds.news import BasicNewsRecipe, prefixed_classes
|
||||
from collections import OrderedDict
|
||||
|
||||
import re
|
||||
|
||||
def absurl(x):
|
||||
if x.startswith('//'):
|
||||
@ -64,9 +64,9 @@ class MitTechnologyReview(BasicNewsRecipe):
|
||||
|
||||
def get_cover_url(self):
|
||||
soup = self.index_to_soup('https://www.technologyreview.com/')
|
||||
div = soup.find('div', attrs={'class':lambda s: s and s.startswith('magazineSidebar__imageWrap')})
|
||||
img = div.find('img', src=True)
|
||||
return img['src']
|
||||
if script := soup.find('script', id='preload'):
|
||||
link = re.findall('https\S+?front_cover-web.png', self.tag_to_string(script))
|
||||
return link[0] + '?fit=572,786'
|
||||
|
||||
def parse_index(self):
|
||||
soup = self.index_to_soup(self.INDEX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user