This commit is contained in:
Kovid Goyal 2025-01-20 08:08:14 +05:30
commit 6865c5eea3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 7 additions and 5 deletions

View File

@ -123,6 +123,7 @@ def load_article_from_web_json(raw):
data = json.loads(raw)['props']['pageProps']['cp2Content'] data = json.loads(raw)['props']['pageProps']['cp2Content']
body += f'<div style="color: red; font-size:small; font-weight:bold;">{data.get("flyTitle", "")}</div>' body += f'<div style="color: red; font-size:small; font-weight:bold;">{data.get("flyTitle", "")}</div>'
body += f'<h1>{data["headline"]}</h1>' body += f'<h1>{data["headline"]}</h1>'
if data.get("rubric") and data.get("rubric") is not None:
body += f'<div style="font-style: italic; color:#202020;">{data.get("rubric", "")}</div>' body += f'<div style="font-style: italic; color:#202020;">{data.get("rubric", "")}</div>'
try: try:
date = data['dateModified'] date = data['dateModified']

View File

@ -123,6 +123,7 @@ def load_article_from_web_json(raw):
data = json.loads(raw)['props']['pageProps']['cp2Content'] data = json.loads(raw)['props']['pageProps']['cp2Content']
body += f'<div style="color: red; font-size:small; font-weight:bold;">{data.get("flyTitle", "")}</div>' body += f'<div style="color: red; font-size:small; font-weight:bold;">{data.get("flyTitle", "")}</div>'
body += f'<h1>{data["headline"]}</h1>' body += f'<h1>{data["headline"]}</h1>'
if data.get("rubric") and data.get("rubric") is not None:
body += f'<div style="font-style: italic; color:#202020;">{data.get("rubric", "")}</div>' body += f'<div style="font-style: italic; color:#202020;">{data.get("rubric", "")}</div>'
try: try:
date = data['dateModified'] date = data['dateModified']

View File

@ -98,13 +98,13 @@ class TheHindu(BasicNewsRecipe):
raw = self.index_to_soup(url, raw=True) raw = self.index_to_soup(url, raw=True)
soup = self.index_to_soup(raw) soup = self.index_to_soup(raw)
ans = self.hindu_parse_index(soup) ans = self.hindu_parse_index(soup)
cover = soup.find(attrs={'class':'hindu-ad'})
if cover:
self.cover_url = cover.img['src']
if not ans: if not ans:
raise ValueError( raise ValueError(
'The Hindu Newspaper is not published Today.' 'The Hindu Newspaper is not published Today.'
) )
cover = soup.find(attrs={'class':'hindu-ad'})
if cover:
self.cover_url = cover.img['src']
if mag_url: if mag_url:
self.log('\nFetching Magazine') self.log('\nFetching Magazine')
soup = self.index_to_soup(mag_url) soup = self.index_to_soup(mag_url)