| 1 |
#!/usr/bin/env python |
| 2 |
# vim:fileencoding=utf-8 |
| 3 |
from __future__ import absolute_import, division, print_function, unicode_literals |
| 4 |
|
| 5 |
__license__ = 'GPL v3' |
| 6 |
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>' |
| 7 |
|
| 8 |
''' |
| 9 |
www.gva.be |
| 10 |
''' |
| 11 |
|
| 12 |
import re |
| 13 |
|
| 14 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 15 |
|
| 16 |
|
| 17 |
class GazetvanAntwerpen(BasicNewsRecipe): |
| 18 |
title = 'Gazet van Antwerpen' |
| 19 |
__author__ = 'Darko Miletic' |
| 20 |
description = 'News from Belgium in Dutch' |
| 21 |
publisher = 'Mediahuis' |
| 22 |
category = 'news, politics, Belgium' |
| 23 |
language = 'nl_BE' |
| 24 |
|
| 25 |
oldest_article = 2 |
| 26 |
max_articles_per_feed = 100 |
| 27 |
no_stylesheets = True |
| 28 |
use_embedded_content = False |
| 29 |
remove_javascript = True |
| 30 |
|
| 31 |
masthead_url = 'http://2.gvacdn.be/extra/assets/img/gazet-van-antwerpen-red.svg' |
| 32 |
|
| 33 |
feeds = [ |
| 34 |
('Stad & Regio', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/stadenregio'), |
| 35 |
('Economie', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/economie'), |
| 36 |
('Binnenland', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/binnenland'), |
| 37 |
('Buitenland', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/buitenland'), |
| 38 |
('Media & Cultuur', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/mediaencultuur'), |
| 39 |
('Sport', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/sport'), |
| 40 |
] |
| 41 |
|
| 42 |
keep_only_tags = [ |
| 43 |
dict(name='header', attrs={'class': 'article__header'}), |
| 44 |
dict(name='footer', attrs={'class': 'article__meta'}), |
| 45 |
dict(name='div', attrs={'class': ['article', 'article__body', 'slideshow__intro']}), |
| 46 |
dict(name='figure', attrs={'class': 'article__image'}), |
| 47 |
] |
| 48 |
|
| 49 |
remove_tags = [ |
| 50 |
dict(name=['embed', 'object']), |
| 51 |
dict(name='div', attrs={'class': ['note NotePortrait', 'note']}), |
| 52 |
dict(name='ul', attrs={'class': re.compile(r'article__share')}), |
| 53 |
dict(name='div', attrs={'class': 'slideshow__controls'}), |
| 54 |
dict(name='a', attrs={'role': 'button'}), |
| 55 |
dict(name='figure', attrs={'class': re.compile(r'video')}), |
| 56 |
] |
| 57 |
|
| 58 |
remove_attributes = ['width', 'height'] |
| 59 |
|
| 60 |
def preprocess_html(self, soup): |
| 61 |
del soup.body['onload'] |
| 62 |
for item in soup.findAll(style=True): |
| 63 |
del item['style'] |
| 64 |
return soup |