Debian Codegraph @

recipes/de_standaard.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 import re
6
7 from calibre.web.feeds.news import BasicNewsRecipe
8
9
10 class AdvancedUserRecipe1467571059(BasicNewsRecipe):
11 title = 'De Standaard'
12 __author__ = 'Darko Miletic, Aimylios, oCkz7bJ_'
13 description = 'De Standaard'
14 publisher = 'Mediahuis'
15 category = 'news, politics, Belgium'
16 language = 'nl_BE'
17
18 oldest_article = 2
19 max_articles_per_feed = 100
20 no_stylesheets = True
21 use_embedded_content = False
22 remove_javascript = True
23
24 cover_url = 'http://www.standaard.be/extra/assets/extra/dslive/headers/ds-black.svg'
25 masthead_url = 'http://tonysweb.be/m/img/tijdschriften/de_standaard.svg'
26
27 # Source: http://www.standaard.be/rssfeeds
28 feeds = [
29 # Nieuws
30 ('Binnenland', 'http://www.standaard.be/rss/section/1f2838d4-99ea-49f0-9102-138784c7ea7c'),
31 ('Buitenland', 'http://www.standaard.be/rss/section/e70ccf13-a2f0-42b0-8bd3-e32d424a0aa0'),
32 ('Cultuur', 'http://www.standaard.be/rss/section/ab8d3fd8-bf2f-487a-818b-9ea546e9a859'),
33 ('Media', 'http://www.standaard.be/rss/section/eb1a6433-ca3f-4a3b-ab48-a81a5fb8f6e2'),
34 ('Economie', 'http://www.standaard.be/rss/section/451c8e1e-f9e4-450e-aa1f-341eab6742cc'),
35 ('Sport', 'http://www.standaard.be/rss/section/8f693cea-dba8-46e4-8575-807d1dc2bcb7'),
36 ('Beroemd en Bizar', 'http://www.standaard.be/rss/section/113a9a78-f65a-47a8-bd1c-b24483321d0f'),
37 # Standaard.biz
38 ('Overzicht', 'http://www.standaard.be/rss/section/a30afc42-3737-4301-8f8a-5b6833855457'),
39 ('Economie', 'http://www.standaard.be/rss/section/212b8b54-bd91-4c8b-942c-8029e8797d36'),
40 ('Bedrijven', 'http://www.standaard.be/rss/section/6aa8d4fa-4b9a-40d5-aa8f-87ac72472f27'),
41 ('Consument', 'http://www.standaard.be/rss/section/46025691-2ec4-4a06-b6d7-9773686a24a7'),
42 ('Beurs', 'http://www.standaard.be/rss/section/74cef9d1-3b28-4b90-943a-ce685bf6ed6e'),
43 ('Marketing & Media', 'http://www.standaard.be/rss/section/9bdf4a14-f8bf-4439-aaf1-344181f73e73'),
44 ('Mobilia', 'http://www.standaard.be/rss/section/270b7f8f-dd73-44cb-b622-9f7200a439a7'),
45 # Lifestyle
46 ('Mode', 'http://www.standaard.be/rss/section/3a4b39a1-e58f-42e4-8ae9-a0f90f97f27f'),
47 ('Beauty', 'http://www.standaard.be/rss/section/51dd6a40-e297-409c-af25-9f0301159a1c'),
48 ('Culinair', 'http://www.standaard.be/rss/section/ec1dbffa-a00b-48e6-96f0-00d215f90744'),
49 ('Reizen', 'http://www.standaard.be/rss/section/eed96e23-ed90-4818-83ab-adabf8caf0f4'),
50 ('Design & Wonen', 'http://www.standaard.be/rss/section/f4dd4e8d-6cb1-4eef-abc2-06b0e3d72de4'),
51 ('Gezondheid & Psycho', 'http://www.standaard.be/rss/section/a166bb48-b6b4-4c1a-beb3-9f0301160b75'),
52 ('Glamour', 'http://www.standaard.be/rss/section/06b5429e-beb1-4e76-909c-9f0301162a9c'),
53 ('Lifestyleblog', 'http://www.standaard.be/rss/section/246d27cb-ce7b-4245-bad4-a09f0119b450'),
54 # Weblogs
55 ('Autoblog', 'http://www.standaard.be/rss/tag/autoblog'),
56 ('Beursexperts', 'http://www.standaard.be/rss/tag/beursexperts'),
57 ('En nu even elders', 'http://www.standaard.be/rss/tag/blog-en-nu-even-elders'),
58 ('Marketingblog', 'http://www.standaard.be/rss/tag/marketingblog'),
59 ('TV-blog', 'http://www.standaard.be/rss/tag/tv-blog'),
60 # Interactie
61 ('Opinies', 'http://feeds.feedburner.com/dso-meningen-opinie'),
62 ]
63
64 keep_only_tags = [
65 dict(name='header', attrs={'class': 'article__header'}),
66 dict(name='footer', attrs={'class': 'article__meta'}),
67 dict(name='article', attrs={'class': 'article-full'}),
68 dict(name='figure', attrs={'class': 'article__image'}),
69 ]
70
71 remove_tags = [
72 dict(name=['embed', 'object']),
73 dict(name='div', attrs={'class': ['note NotePortrait', 'note']}),
74 dict(name='ul', attrs={'class': re.compile(r'article__share')}),
75 dict(name='div', attrs={'class': 'slideshow__controls'}),
76 dict(name='a', attrs={'role': 'button'}),
77 dict(name='figure', attrs={'class': re.compile(r'video')}),
78 ]
79
80 remove_attributes = ['width', 'height']
81
82 def preprocess_html(self, soup):
83 del soup.body['onload']
84 for item in soup.findAll(style=True):
85 del item['style']
86 return soup