mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Update Financial Times
This commit is contained in:
parent
3f013c3856
commit
95b2e521c4
@ -21,13 +21,23 @@ class ft(BasicNewsRecipe):
|
|||||||
extra_css = '#fig-cap{font-style:italic; text-align:left; font-size:small;}'
|
extra_css = '#fig-cap{font-style:italic; text-align:left; font-size:small;}'
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
soup = self.index_to_soup(
|
from datetime import date
|
||||||
'https://www.todayspapers.co.uk/the-financial-times-front-page-today/'
|
cover = 'http://img.kiosko.net/' + str(
|
||||||
)
|
date.today().year
|
||||||
tag = soup.find('div', attrs={'class': 'elementor-image'})
|
) + '/' + date.today().strftime('%m') + '/' + date.today(
|
||||||
if tag:
|
).strftime('%d') + '/uk/ft_uk.750.jpg'
|
||||||
self.cover_url = tag.find('img')['src']
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
return getattr(self, 'cover_url', self.cover_url)
|
try:
|
||||||
|
br.open(cover)
|
||||||
|
except:
|
||||||
|
index = 'https://en.kiosko.net/uk/np/ft_uk.html'
|
||||||
|
soup = self.index_to_soup(index)
|
||||||
|
for image in soup.findAll('img', src=True):
|
||||||
|
if image['src'].endswith('750.jpg'):
|
||||||
|
return image['src']
|
||||||
|
self.log("\nCover unavailable")
|
||||||
|
cover = None
|
||||||
|
return cover
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
('World', 'https://www.ft.com/world?format=rss'),
|
('World', 'https://www.ft.com/world?format=rss'),
|
||||||
|
@ -19,13 +19,23 @@ class ft(BasicNewsRecipe):
|
|||||||
extra_css = '#fig-cap{font-style:italic; text-align:left; font-size:small;}'
|
extra_css = '#fig-cap{font-style:italic; text-align:left; font-size:small;}'
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
soup = self.index_to_soup(
|
from datetime import date
|
||||||
'https://www.todayspapers.co.uk/the-financial-times-front-page-today/'
|
cover = 'http://img.kiosko.net/' + str(
|
||||||
)
|
date.today().year
|
||||||
tag = soup.find('div', attrs={'class': 'elementor-image'})
|
) + '/' + date.today().strftime('%m') + '/' + date.today(
|
||||||
if tag:
|
).strftime('%d') + '/uk/ft_uk.750.jpg'
|
||||||
self.cover_url = tag.find('img')['src']
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
return getattr(self, 'cover_url', self.cover_url)
|
try:
|
||||||
|
br.open(cover)
|
||||||
|
except:
|
||||||
|
index = 'https://en.kiosko.net/uk/np/ft_uk.html'
|
||||||
|
soup = self.index_to_soup(index)
|
||||||
|
for image in soup.findAll('img', src=True):
|
||||||
|
if image['src'].endswith('750.jpg'):
|
||||||
|
return image['src']
|
||||||
|
self.log("\nCover unavailable")
|
||||||
|
cover = None
|
||||||
|
return cover
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
soup = self.index_to_soup('https://www.ft.com/todaysnewspaper/uk')
|
soup = self.index_to_soup('https://www.ft.com/todaysnewspaper/uk')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user