Debian Codegraph @

recipes/dainik_bhaskar.recipe

raw
1 #!/usr/bin/env python
2
3 from calibre.web.feeds.news import BasicNewsRecipe, classes
4
5
6 class DainikBhaskar(BasicNewsRecipe):
7 title = 'दैनिक भास्कर'
8 description = (
9 'Dainik Bhaskar is an Indian Hindi-language daily newspaper owned by the Dainik Bhaskar Group.'
10 ' It is ranked 4th in the world by circulation and is the largest newspaper in India by circulation.'
11 )
12 language = 'hi'
13 __author__ = 'unkn0wn'
14 oldest_article = 1 # days
15 max_articles_per_feed = 50
16 encoding = 'utf-8'
17 use_embedded_content = False
18 masthead_url = 'https://tse4.mm.bing.net/th?id=OIP.t6kK1-rSpzNbSerwzD5qbQHaDY'
19 no_stylesheets = True
20 remove_attributes = ['style', 'height', 'width']
21 ignore_duplicate_articles = {'url'}
22
23 def get_cover_url(self):
24 soup = self.index_to_soup('https://epaper.bhaskar.com/')
25 tag = soup.find(attrs={'class': 'scaleDiv'})
26 if tag:
27 self.cover_url = tag.find('img')['src'].replace('_ss.jpg', '_l.jpg')
28 return super().get_cover_url()
29
30 keep_only_tags = [
31 classes('f5afa1d3'),
32 ]
33
34 remove_tags = [
35 classes('_3c197847 _66d97d7f e0d43c76 bhaskar-widget-container-class _28e65306 _8adadf19 _07c65a39'),
36 dict(name='svg'),
37 ]
38
39 feeds = [
40 ('देश ', 'https://www.bhaskar.com/rss-v1--category-1061.xml'),
41 ('ओपिनियन', 'https://www.bhaskar.com/rss-v1--category-1944.xml'),
42 ('विदेश ', 'https://www.bhaskar.com/rss-v1--category-1125.xml'),
43 ('ओरिजिनल', 'https://www.bhaskar.com/rss-v1--category-4587.xml'),
44 ('बिजनेस', 'https://www.bhaskar.com/rss-v1--category-1051.xml'),
45 ('स्पोर्ट्स ', 'https://www.bhaskar.com/rss-v1--category-1053.xml'),
46 ('मैगजीन ', 'https://www.bhaskar.com/rss-v1--category-1057.xml'),
47 ('करिअर ', 'https://www.bhaskar.com/rss-v1--category-11945.xml'),
48 # https://www.bhaskar.com/rss
49 ]