Merge branch 'ByteTheBubble-financial-times-cover' of https://github.com/ByteTheBubble/calibre

This commit is contained in:
Kovid Goyal 2025-05-28 15:47:25 +05:30
commit 9c43f54537
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2,6 +2,7 @@
# vim:fileencoding=utf-8 # vim:fileencoding=utf-8
import json import json
import re import re
from datetime import date
from urllib.parse import quote from urllib.parse import quote
from html5_parser import parse from html5_parser import parse
@ -63,8 +64,11 @@ class ft(BasicNewsRecipe):
] ]
def get_cover_url(self): def get_cover_url(self):
soup = self.index_to_soup('https://www.frontpages.com/financial-times/') url = f"https://www.tomorrowspapers.co.uk/financial-times-front-page-{date.today():%Y-%m-%d}/"
return 'https://www.frontpages.com' + soup.find('img', attrs={'id':'giornale-img'})['src'] soup = self.index_to_soup(url)
img = soup.select_one('img.attachment-full[src*="Financial-Times"]')
src = img['src']
return src
# needs_subscription = 'optional' # needs_subscription = 'optional'
# #