mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
...
This commit is contained in:
parent
b163544adf
commit
c6245becef
@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
from datetime import date
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe, classes
|
from calibre.web.feeds.news import BasicNewsRecipe, classes
|
||||||
|
|
||||||
|
|
||||||
@ -26,11 +26,19 @@ class ft(BasicNewsRecipe):
|
|||||||
return getattr(self, 'cover_url', self.cover_url)
|
return getattr(self, 'cover_url', self.cover_url)
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
soup = self.index_to_soup('https://www.ft.com/todaysnewspaper/')
|
soup = self.index_to_soup('https://www.ft.com/todaysnewspaper/uk')
|
||||||
# UK edition: https://www.ft.com/todaysnewspaper/uk
|
# International edition: https://www.ft.com/todaysnewspaper/international
|
||||||
ans = self.ft_parse_index(soup)
|
ans = self.ft_parse_index(soup)
|
||||||
if not ans:
|
if not ans:
|
||||||
raise ValueError('Could not find any articles')
|
is_sunday = date.today().weekday() == 6
|
||||||
|
if is_sunday:
|
||||||
|
raise ValueError(
|
||||||
|
'The Financial Times Newspaper is not published on Sundays.'
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise ValueError(
|
||||||
|
'The Financial Times Newspaper is not published today.'
|
||||||
|
)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def ft_parse_index(self, soup):
|
def ft_parse_index(self, soup):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user