From ba368aba92afcb6be3680ca440640a6fd53332c3 Mon Sep 17 00:00:00 2001
From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com>
Date: Fri, 29 Sep 2023 10:36:59 +0530
Subject: [PATCH] Update toiprint.recipe
---
recipes/toiprint.recipe | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/recipes/toiprint.recipe b/recipes/toiprint.recipe
index 87c14307cf..b2a961cf82 100644
--- a/recipes/toiprint.recipe
+++ b/recipes/toiprint.recipe
@@ -5,9 +5,9 @@ from datetime import date
# default edition is Delhi i.e., 'cap'
# Hyderabad - 'toih'; Delhi - 'cap'; Mumbai - 'toim'; Banglore - 'toibgc';
+# Chennai - 'toich'; Chandigarh - 'toicgct'; Jaipur - 'toijc'; Kolkata - 'toikc';
# There are others too, try to figure it out, visit toi epaper link.
-# for example, replace 'cap' with 'toih', if you want Hyderabad edition.
le = 'cap' # local edition;
date0 = date.today().strftime('%Y/%m/%d')
@@ -41,6 +41,7 @@ class toiprint(BasicNewsRecipe):
.auth { font-size:small; font-weight:bold; color:#202020; }
.cap { text-align:center; font-size:small; }
img { display:block; margin:0 auto; }
+ .info { font-size:small; color:#404040; }
'''
def get_cover_url(self):
@@ -69,14 +70,12 @@ class toiprint(BasicNewsRecipe):
for art in sec['Articles']:
if 'ArticleName' not in art:
continue
- link = art['ArticleName']
- page = link.split('_')[-3]
- url = page + '/' + link
- title = art.get('ArticleTitle', 'unknown')
+ url = art['ArticleName']
+ title = art.get('ArticleTitle', 'unknown').replace('
', '')
if art.get('ColumnTitle', '') == '':
- desc = 'Page No.' + page + ' | ' + art.get('ArticleBody', '')
+ desc = 'Page No.' + url.split('_')[-3] + ' | ' + art.get('ArticleBody', '')
else:
- desc = 'Page No.' + page + ' | ' + art.get('ColumnTitle', '')
+ desc = 'Page No.' + url.split('_')[-3] + ' | ' + art.get('ColumnTitle', '')
self.log('\t', title, '\n\t', desc, '\n\t\t', url)
articles.append({'title': title, 'description':desc, 'url': url})
if articles:
@@ -89,21 +88,27 @@ class toiprint(BasicNewsRecipe):
for x in data:
if x['TagName'] == 'ArticleTitle':
body += '
' + x['ZoneText'] + '
' - if x['TagName'] == 'Author': + elif x['TagName'] == 'Author': body += '' + x['ZoneText'].replace('
', '') + '
' + x['ZoneText'] + '
' + elif x['TagName'] in {'LinkTo', 'LinkFrom'}: body += '' + x['ZoneText'] + '
' - if x['TagName'] == 'Photographs': + elif x['TagName'] == 'Photographs': pag = x['ZoneID'].split('_')[-4] body += '' - return '
').replace('
', '
') + '
' + x['ZoneText'] + '
' + return '').replace('
', '
').replace('<br>', '
').replace('\n', '