This commit is contained in:
Kovid Goyal 2023-09-19 12:41:49 +05:30
parent b75eae4a65
commit 9aeb25d9ac
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -4,7 +4,7 @@ from datetime import date
# default edition is Delhi i.e., 'cap' # default edition is Delhi i.e., 'cap'
# Hyderabad - 'toih'; Delhi - 'cap'; Mumbai - 'toim'; Banglore - 'toibgc'; # Hyderabad - 'toih'; Delhi - 'cap'; Mumbai - 'toim'; Banglore - 'toibgc';
# There are others too, try to figure it out, visit toi epaper link. # There are others too, try to figure it out, visit toi epaper link.
# for example, replace 'cap' with 'toih', if you want Hyderabad edition. # for example, replace 'cap' with 'toih', if you want Hyderabad edition.
@ -14,7 +14,7 @@ le = 'cap' # local edition;
date0 = date.today().strftime('%Y/%m/%d') date0 = date.today().strftime('%Y/%m/%d')
date_ = date.today().strftime('%d_%m_%Y') date_ = date.today().strftime('%d_%m_%Y')
# for older edition change both date0 and date_ below. # for older edition change both date0 and date_ below.
# date0 = '2023/09/15' # date0 = '2023/09/15'
# date_ = '15_09_2023' # date_ = '15_09_2023'
@ -68,7 +68,7 @@ class toiprint(BasicNewsRecipe):
for sec in link['Views']: for sec in link['Views']:
if 'Articles' in sec: if 'Articles' in sec:
for art in sec['Articles']: for art in sec['Articles']:
if not 'ArticleName' in art: if 'ArticleName' not in art:
continue continue
link = art['ArticleName'] link = art['ArticleName']
page = link.split('_')[-3] page = link.split('_')[-3]
@ -102,6 +102,6 @@ class toiprint(BasicNewsRecipe):
if x['TagName'] == 'ImageCaption': if x['TagName'] == 'ImageCaption':
body += '<div class="cap">' + x['ZoneText'] + '</div><p>' body += '<div class="cap">' + x['ZoneText'] + '</div><p>'
return '<html><body><div>' + body.replace('<br>', '<p>') + '</div></body></html>' return '<html><body><div>' + body.replace('<br>', '<p>') + '</div></body></html>'
def print_version(self, url): def print_version(self, url):
return index + '/ArticleZoneJson/' + url.replace('-', '/') + '.json' return index + '/ArticleZoneJson/' + url.replace('-', '/') + '.json'