Debian Codegraph @

recipes/le_peuple_breton.recipe

raw
1 #!/usr/bin/env python
2 # vim:fileencoding=utf-8
3 from __future__ import absolute_import, division, print_function, unicode_literals
4
5 from calibre.web.feeds.news import BasicNewsRecipe
6
7 # author: <[email protected]>
8
9
10 class LePeupleBreton(BasicNewsRecipe):
11 title = 'Le Peuple Breton'
12 __author__ = 'Lionel Plais'
13 description = "Aujourd'hui, être libre c'est être informé"
14 oldest_article = 90
15 language = 'fr'
16 cover_img_url = 'http://lepeuplebreton.bzh/wp-content/uploads/2017/11/le-peuple-breton-logo.jpg'
17 masthead_url = cover_img_url
18 remove_javascript = True
19 no_stylesheets = True
20
21 keep_only_tags = [
22 dict(name='article'),
23 ]
24
25 remove_tags = [
26 dict(name='div', attrs={'class': ['share-post', 'juiz_sps_links', 'counters_both', 'juiz_sps_displayed_bottom']}),
27 ]
28
29 feeds = [
30 ('À la Une', 'http://lepeuplebreton.bzh/category/a-la-une/feed/'),
31 ('Bretagne', 'http://lepeuplebreton.bzh/category/themes/bretagne/feed/'),
32 ('France', 'http://lepeuplebreton.bzh/category/lieu/france/feed/'),
33 ('International', 'http://lepeuplebreton.bzh/category/lieu/international-fr/feed/'),
34 ('Point de vue', 'http://lepeuplebreton.bzh/category/themes/point-de-vue/feed/'),
35 ('Économie', 'https://lepeuplebreton.bzh/category/themes/economie/feed/'),
36 ('Écologie', 'http://lepeuplebreton.bzh/category/themes/ecologie/feed/'),
37 ('Santé', 'http://lepeuplebreton.bzh/category/themes/sante/feed/'),
38 ('Culture & Sport', 'http://lepeuplebreton.bzh/category/themes/culture/feed/'),
39 ]
40
41 def preprocess_html(self, soup):
42 for alink in soup.findAll('a'):
43 if alink.string is not None:
44 tstr = alink.string
45 alink.replaceWith(tstr)
46 return soup