This commit is contained in:
Kovid Goyal 2017-06-20 18:00:07 +05:30
commit 65f7c7e794
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -45,6 +45,22 @@ class TimesOnline(BasicNewsRecipe):
'comment': description, 'tags': category, 'publisher': publisher, 'language': language
}
def get_cover_url(self):
from datetime import date
cover = 'http://img.kiosko.net/' + str(date.today().year) + '/' + date.today().strftime('%m') + '/' + date.today().strftime('%d') + '/uk/the_times.750.jpg'
br = BasicNewsRecipe.get_browser(self)
try:
br.open(cover)
except:
index = 'http://en.kiosko.net/uk/np/the_times.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 get_browser(self):
br = BasicNewsRecipe.get_browser(self)
br.open('http://www.thetimes.co.uk/')