mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Foreign Policy
This commit is contained in:
parent
7a58dc3e28
commit
bd896bbee9
@ -39,7 +39,7 @@ class ForeignPolicy(BasicNewsRecipe):
|
|||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
soup = self.index_to_soup('https://foreignpolicy.com/the-magazine')
|
soup = self.index_to_soup('https://foreignpolicy.com/the-magazine')
|
||||||
img = soup.find('img', src=True, attrs={'alt': lambda x: x and 'foreign-policy-magazine-cover' in x})
|
img = soup.find('img', src=True, attrs={'alt': lambda x: x and 'foreign-policy-cover' in x})
|
||||||
self.cover_url = img['src']
|
self.cover_url = img['src']
|
||||||
current_section = None
|
current_section = None
|
||||||
amap = OrderedDict()
|
amap = OrderedDict()
|
||||||
@ -65,6 +65,8 @@ class ForeignPolicy(BasicNewsRecipe):
|
|||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
for img in soup.findAll('img', attrs={'data-srcset': True}):
|
for img in soup.findAll('img', attrs={'data-srcset': True}):
|
||||||
img['src'] = img['data-srcset'].split()[0]
|
img['src'] = img['data-srcset'].split()[0]
|
||||||
|
for img in soup.findAll('img', src=False, attrs={'data-src': True}):
|
||||||
|
img['src'] = img['data-src']
|
||||||
body = soup.find('body')
|
body = soup.find('body')
|
||||||
div = soup.find(
|
div = soup.find(
|
||||||
attrs={'class': lambda x: x and 'wide_header_bg' in x.split()})
|
attrs={'class': lambda x: x and 'wide_header_bg' in x.split()})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user