Debian Codegraph @

recipes/hindustan.recipe

raw
1 #!/usr/bin/env python
2
3 from calibre.web.feeds.news import BasicNewsRecipe, classes
4
5
6 class LiveHindustan(BasicNewsRecipe):
7 title = 'हिंदुस्तान'
8 description = 'भरोसा नए हिन्दुस्तान का। दुनिया भर में रहने वाले हिन्दीभाषी लोगों को हिन्दुस्तान समाचार पत्र के व्यापक नेटवर्क. '
9 language = 'hi'
10 __author__ = 'unkn0wn'
11 oldest_article = 1 # days
12 max_articles_per_feed = 50
13 encoding = 'utf-8'
14 use_embedded_content = False
15 masthead_url = 'https://www.livehindustan.com/static/images/new/logo/livehindustan.svg'
16 no_stylesheets = True
17 remove_attributes = ['style', 'height', 'width']
18 ignore_duplicate_articles = {'url'}
19
20 keep_only_tags = [
21 classes('page-hdng stry-shrt-head img-hgt-blk athr-info tm-stmp stry-bdy'),
22 ]
23
24 remove_tags = [
25 classes('prlads ads'),
26 dict(name='section', attrs={'class': 'glry-cnt mostvdtm main-wdgt glry-bg'}),
27 ]
28 remove_tags_after = [classes('stry-bdy')]
29
30 feeds = [
31 ('प्रमुख खबरें', 'https://feed.livehindustan.com/rss/3127'),
32 ('देश', 'https://feed.livehindustan.com/rss/4911'),
33 ('विदेश', 'https://feed.livehindustan.com/rss/4913'),
34 ('ओपिनियन', 'https://feed.livehindustan.com/rss/5165'),
35 ('बिजनेस', 'https://feed.livehindustan.com/rss/4950'),
36 ('क्रिकेट', 'https://feed.livehindustan.com/rss/4925'),
37 ('खेल', 'https://feed.livehindustan.com/rss/4931'),
38 ('विज्ञान', 'https://feed.livehindustan.com/rss/1349437'),
39 ('गैजेट्स', 'https://feed.livehindustan.com/rss/4955'),
40 ('क्राइम', 'https://feed.livehindustan.com/rss/469651'),
41 ('करियर', 'https://feed.livehindustan.com/rss/4979'),
42 # https://www.livehindustan.com/rss/#collapseOne3116
43 ]
44
45 def get_cover_url(self):
46 soup = self.index_to_soup('https://www.magzter.com/IN/HT-Digital-Streams-Ltd./Hindustan-Times-Hindi-New-Delhi/Newspaper/')
47 return soup.find('img', id=lambda s: s and 'mgd__lhd__cover' in s.split())['src']