Update press_information_bureau.recipe

This commit is contained in:
unkn0w7n 2025-08-02 19:09:28 +05:30
parent da640add79
commit 9305014fd2

View File

@ -1,30 +1,31 @@
#!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes
class PIB(BasicNewsRecipe): class PIB(BasicNewsRecipe):
title = u'Press Information Bureau' title = 'Press Information Bureau'
language = 'en_IN' language = 'en_IN'
__author__ = 'unkn0wn' __author__ = 'unkn0wn'
no_stylesheets = True no_stylesheets = True
use_embedded_content = False use_embedded_content = False
remove_attributes = ['style','height','width'] remove_attributes = ['style', 'height', 'width']
ignore_duplicate_articles = {'url'} ignore_duplicate_articles = {'url'}
description = ('The Press Information Bureau (PIB) is the nodal agency of the Government of India' description = (
' to disseminate information to the print and electronic media on government policies,' 'The Press Information Bureau (PIB) is the nodal agency of the Government of India'
' programmes, initiatives and achievements. Best downloaded at the end of the day!') ' to disseminate information to the print and electronic media on government policies,'
' programmes, initiatives and achievements. Best downloaded at the end of the day!'
)
extra_css = ''' extra_css = '''
#ltrSubtitle{color:#404040;} #ltrSubtitle{color:#404040;}
blockquote{color:#404040;} blockquote{color:#404040;}
.ReleaseDateSubHeaddateTime{font-style:italic; font-size:small;} .ReleaseDateSubHeaddateTime{font-style:italic; font-size:small;}
''' '''
masthead_url = 'https://tse3.mm.bing.net/th?id=OIP.4QE8KPl1dZ3_BoR3X92aqgHaIH'
keep_only_tags = [ masthead_url = 'https://tse3.mm.bing.net/th?id=OIP.4QE8KPl1dZ3_BoR3X92aqgHaIH'
classes('innner-page-main-about-us-content-right-part') cover_url = 'https://static.pib.gov.in/WriteReadData/specificdocs/photo/2024/jun/ph2024624343601.jpg'
]
remove_tags = [ keep_only_tags = [classes('innner-page-main-about-us-content-right-part')]
classes('ReleaseLang log_oo') remove_tags = [classes('ReleaseLang log_oo')]
]
def parse_index(self): def parse_index(self):
soup = self.index_to_soup('https://pib.gov.in/Allrel.aspx') soup = self.index_to_soup('https://pib.gov.in/Allrel.aspx')
@ -37,7 +38,7 @@ class PIB(BasicNewsRecipe):
for a in div.findAll('a', href=True): for a in div.findAll('a', href=True):
url = a['href'] url = a['href']
if url.startswith('/'): if url.startswith('/'):
url = 'https://pib.gov.in' + url url = 'https://pib.gov.in' + url
title = self.tag_to_string(a) title = self.tag_to_string(a)
self.log('\t', title, '\n\t\t', url) self.log('\t', title, '\n\t\t', url)
articles.append({'title': title, 'url': url}) articles.append({'title': title, 'url': url})