Debian Codegraph @

recipes/irish_independent.recipe

raw
1 __license__ = 'GPL v3'
2 __copyright__ = '2009 Neil Grogan'
3 #
4 # Irish Independent Recipe
5 #
6
7 from calibre.web.feeds.news import BasicNewsRecipe
8
9
10 class IrishIndependent(BasicNewsRecipe):
11 title = 'Irish Independent'
12 description = 'Irish and World news from Irelands Bestselling Daily Broadsheet'
13 __author__ = 'Neil Grogan'
14 language = 'en_IE'
15 oldest_article = 2
16 max_articles_per_feed = 100
17 no_stylesheets = True
18 ignore_duplicate_articles = {'url'}
19
20 keep_only_tags = [dict(name='div', attrs={'class': lambda x: x and '_contentwrapper' in x})]
21
22 remove_tags = [dict(name=['svg', 'button']), dict(name='div', attrs={'data-testid': ['article-share', 'embed-video', 'inline-related-wrapper']})]
23
24 feeds = [
25 ('Frontpage News', 'http://www.independent.ie/rss'),
26 ('World News', 'http://www.independent.ie/world-news/rss'),
27 ('Opinion', 'http://www.independent.ie/opinion/rss'),
28 ('Business', 'http://www.independent.ie/business/rss'),
29 ('Sport', 'http://www.independent.ie/sport/rss'),
30 ('Life', 'http://www.independent.ie/life/rss'),
31 ('Style', 'http://www.independent.ie/style/rss'),
32 ('Entertainment', 'http://www.independent.ie/business/rss'),
33 ]
34
35 def preprocess_html(self, soup):
36 for img in soup.findAll(attrs={'data-src': True}):
37 img['src'] = img['data-src']
38 return soup