This commit is contained in:
Kovid Goyal 2024-07-22 18:50:02 +05:30
parent c9fefbcd54
commit 9e0bf731d3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 15 additions and 11 deletions

View File

@ -34,7 +34,12 @@ class TheHindu(BasicNewsRecipe):
recipe_specific_options = {
'location': {
'short': 'The name of the local edition',
'long': 'If The Hindu is available in your local town/city,\nset this to your location, for example, hyderabad\nAvailable Editions: bengaluru, chennai, coimbatore, delhi, erode, hyderabad, international, kochi, kolkata,\nkozhikode, madurai, mangalore, mumbai, thiruvananthapuram, tiruchirapalli, vijayawada, visakhapatnam',
'long': ('If The Hindu is available in your local town/city,\n'
'set this to your location, for example, hyderabad\n'
'Available Editions: bengaluru, chennai, coimbatore, delhi, '
'erode, hyderabad, international, kochi, kolkata,\n'
'kozhikode, madurai, mangalore, mumbai, thiruvananthapuram, '
'tiruchirapalli, vijayawada, visakhapatnam'),
'default': 'international'
},
'date': {

View File

@ -39,6 +39,8 @@ class TheHindufeeds(BasicNewsRecipe):
d = self.recipe_specific_options.get('days')
if d and isinstance(d, str):
self.oldest_article = float(d)
if self.output_profile.short_name.startswith('kindle'):
self.title = 'The Hindu (Feeds) ' + date.today().strftime('%b %d, %Y')
ignore_duplicate_articles = {'url'}
@ -76,14 +78,9 @@ class TheHindufeeds(BasicNewsRecipe):
src.extract()
return soup
def __init__(self, *args, **kwargs):
BasicNewsRecipe.__init__(self, *args, **kwargs)
if self.output_profile.short_name.startswith('kindle'):
self.title = 'The Hindu (Feeds) ' + date.today().strftime('%b %d, %Y')
def get_cover_url(self):
soup = self.index_to_soup('https://www.thehindu.com/todays-paper/')
soup = self.index_to_soup('https://www.thehindu.com/todays-paper/')
if cover := soup.find(attrs={'class':'hindu-ad'}):
return cover.img['src']

View File

@ -6,7 +6,6 @@ from datetime import date
from calibre.web.feeds.news import BasicNewsRecipe
index = 'https://epaper.hindustantimes.com'
class ht(BasicNewsRecipe):
@ -27,7 +26,11 @@ class ht(BasicNewsRecipe):
recipe_specific_options = {
'location': {
'short': 'The name of the local edition',
'long': 'If The Hindustan Times is available in your local town/city,\nset this to your location, for example, Delhi\nAvailable Editions: Delhi, Mumbai, Chandigarh, Lucknow, Patna, Bengaluru, Pune, Gurgaon, Ludhiana, Rajasthan, Amritsar,\nEast UP, Haryana, Jammu, Navi Mumbai, Noida, Punjab, Ranchi, Thane, Uttarakhand, West UP',
'long': ('If The Hindustan Times is available in your local town/city,\n'
'set this to your location, for example, Delhi\nAvailable Editions:'
'Delhi, Mumbai, Chandigarh, Lucknow, Patna, Bengaluru, Pune, Gurgaon,'
'Ludhiana, Rajasthan, Amritsar,\nEast UP, Haryana, Jammu, Navi Mumbai,'
'Noida, Punjab, Ranchi, Thane, Uttarakhand, West UP'),
'default': 'Delhi'
},
'date': {
@ -55,7 +58,6 @@ class ht(BasicNewsRecipe):
self.timefmt = ' [%s]' % today
day, month, year = (int(x) for x in today.split('/'))
dt = date(year, month, day)
today = today.replace('/', '%2F')
get_edition = index + '/Home/GetEditionSupplementHierarchy?EditionDate=' + today

View File

@ -49,7 +49,7 @@ class LiveMint(BasicNewsRecipe):
return cov['HighResolution']
if is_saturday:
self.title = 'Mint Lounge'
title = 'Mint Lounge'
masthead_url = 'https://lifestyle.livemint.com/mintlounge/static-images/lounge-logo.svg'
oldest_article = 6.5 # days