mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
***
This commit is contained in:
parent
275d670a6a
commit
9d519d7dc8
@ -263,7 +263,8 @@ class Economist(BasicNewsRecipe):
|
|||||||
dt = datetime.fromisoformat(data['datePublished'][:-1]) + timedelta(seconds=time.timezone)
|
dt = datetime.fromisoformat(data['datePublished'][:-1]) + timedelta(seconds=time.timezone)
|
||||||
dt = dt.strftime('%b %d, %Y')
|
dt = dt.strftime('%b %d, %Y')
|
||||||
self.timefmt = ' [' + dt + ']'
|
self.timefmt = ' [' + dt + ']'
|
||||||
self.cover_url = data['image']['cover'][0]['url']['canonical']
|
self.cover_url = data['image']['cover'][0]['url']['canonical'].replace('economist.com/',
|
||||||
|
'economist.com/cdn-cgi/image/width=960,quality=80,format=auto/')
|
||||||
self.log('Got cover:', self.cover_url)
|
self.log('Got cover:', self.cover_url)
|
||||||
|
|
||||||
feeds_dict = defaultdict(list)
|
feeds_dict = defaultdict(list)
|
||||||
@ -290,6 +291,12 @@ class Economist(BasicNewsRecipe):
|
|||||||
def populate_article_metadata(self, article, soup, first):
|
def populate_article_metadata(self, article, soup, first):
|
||||||
article.url = soup.find('h1')['title']
|
article.url = soup.find('h1')['title']
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for img in soup.findAll('img', src=True):
|
||||||
|
img['src'] = img['src'].replace('economist.com/',
|
||||||
|
'economist.com/cdn-cgi/image/width=600,quality=80,format=auto/')
|
||||||
|
return soup
|
||||||
|
|
||||||
else: # Load articles from individual article pages {{{
|
else: # Load articles from individual article pages {{{
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
# return self.economist_test_article()
|
# return self.economist_test_article()
|
||||||
|
@ -263,7 +263,8 @@ class Economist(BasicNewsRecipe):
|
|||||||
dt = datetime.fromisoformat(data['datePublished'][:-1]) + timedelta(seconds=time.timezone)
|
dt = datetime.fromisoformat(data['datePublished'][:-1]) + timedelta(seconds=time.timezone)
|
||||||
dt = dt.strftime('%b %d, %Y')
|
dt = dt.strftime('%b %d, %Y')
|
||||||
self.timefmt = ' [' + dt + ']'
|
self.timefmt = ' [' + dt + ']'
|
||||||
self.cover_url = data['image']['cover'][0]['url']['canonical']
|
self.cover_url = data['image']['cover'][0]['url']['canonical'].replace('economist.com/',
|
||||||
|
'economist.com/cdn-cgi/image/width=960,quality=80,format=auto/')
|
||||||
self.log('Got cover:', self.cover_url)
|
self.log('Got cover:', self.cover_url)
|
||||||
|
|
||||||
feeds_dict = defaultdict(list)
|
feeds_dict = defaultdict(list)
|
||||||
@ -290,6 +291,12 @@ class Economist(BasicNewsRecipe):
|
|||||||
def populate_article_metadata(self, article, soup, first):
|
def populate_article_metadata(self, article, soup, first):
|
||||||
article.url = soup.find('h1')['title']
|
article.url = soup.find('h1')['title']
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for img in soup.findAll('img', src=True):
|
||||||
|
img['src'] = img['src'].replace('economist.com/',
|
||||||
|
'economist.com/cdn-cgi/image/width=600,quality=80,format=auto/')
|
||||||
|
return soup
|
||||||
|
|
||||||
else: # Load articles from individual article pages {{{
|
else: # Load articles from individual article pages {{{
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
# return self.economist_test_article()
|
# return self.economist_test_article()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user