mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Gazet van Antwerpen
This commit is contained in:
parent
85502aa97b
commit
cd917be191
@ -1,12 +1,16 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
|
from __future__ import unicode_literals, division, absolute_import, print_function
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
|
||||||
'''
|
'''
|
||||||
www.gva.be
|
www.gva.be
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import re
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import Tag
|
|
||||||
|
|
||||||
class GazetvanAntwerpen(BasicNewsRecipe):
|
class GazetvanAntwerpen(BasicNewsRecipe):
|
||||||
title = 'Gazet van Antwerpen'
|
title = 'Gazet van Antwerpen'
|
||||||
@ -14,50 +18,45 @@ class GazetvanAntwerpen(BasicNewsRecipe):
|
|||||||
description = 'News from Belgium in Dutch'
|
description = 'News from Belgium in Dutch'
|
||||||
publisher = 'Gazet van Antwerpen'
|
publisher = 'Gazet van Antwerpen'
|
||||||
category = 'news, politics, Belgium'
|
category = 'news, politics, Belgium'
|
||||||
|
language = 'nl_BE'
|
||||||
|
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
encoding = 'utf-8'
|
remove_javascript = True
|
||||||
language = 'nl_BE'
|
|
||||||
|
|
||||||
lang = 'nl-BE'
|
masthead_url = 'http://2.gvacdn.be/extra/assets/img/gazet-van-antwerpen-red.svg'
|
||||||
direction = 'ltr'
|
|
||||||
|
|
||||||
html2lrf_options = [
|
|
||||||
'--comment' , description
|
|
||||||
, '--category' , category
|
|
||||||
, '--publisher', publisher
|
|
||||||
]
|
|
||||||
|
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "'
|
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id':'article'})]
|
|
||||||
remove_tags = [
|
|
||||||
dict(name=['embed','object'])
|
|
||||||
, dict (name='div',attrs={'class':['note NotePortrait','note']})
|
|
||||||
]
|
|
||||||
remove_tags_after = dict(name='span', attrs={'class':'author'})
|
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Binnenland' , u'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/binnenland' )
|
('Stad & Regio', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/stadenregio'),
|
||||||
,(u'Buitenland' , u'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/buitenland' )
|
('Economie', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/economie'),
|
||||||
,(u'Stad & Regio' , u'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/stadenregio' )
|
('Binnenland', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/binnenland'),
|
||||||
,(u'Economie' , u'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/economie' )
|
('Buitenland', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/buitenland'),
|
||||||
,(u'Media & Cultur' , u'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/mediaencultuur')
|
('Media & Cultuur', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/mediaencultuur'),
|
||||||
,(u'Wetenschap' , u'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/wetenschap' )
|
('Sport', 'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/sport')
|
||||||
,(u'Sport' , u'http://www.gva.be/syndicationservices/artfeedservice.svc/rss/mostrecent/sport' )
|
]
|
||||||
]
|
|
||||||
|
keep_only_tags = [
|
||||||
|
dict(name='header', attrs={'class':'article__header'}),
|
||||||
|
dict(name='footer', attrs={'class':'article__meta'}),
|
||||||
|
dict(name='div', attrs={'class':['article', 'article__body', 'slideshow__intro']}),
|
||||||
|
dict(name='figure', attrs={'class':'article__image'})
|
||||||
|
]
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name=['embed', 'object']),
|
||||||
|
dict(name='div', attrs={'class':['note NotePortrait', 'note']}),
|
||||||
|
dict(name='ul', attrs={'class':re.compile('article__share')}),
|
||||||
|
dict(name='div', attrs={'class':'slideshow__controls'}),
|
||||||
|
dict(name='a', attrs={'role':'button'}),
|
||||||
|
dict(name='figure', attrs={'class':re.compile('video')})
|
||||||
|
]
|
||||||
|
|
||||||
|
remove_attributes = ['width', 'height']
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
del soup.body['onload']
|
del soup.body['onload']
|
||||||
for item in soup.findAll(style=True):
|
for item in soup.findAll(style=True):
|
||||||
del item['style']
|
del item['style']
|
||||||
soup.html['lang'] = self.lang
|
|
||||||
soup.html['dir' ] = self.direction
|
|
||||||
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
|
|
||||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
|
||||||
soup.head.insert(0,mlang)
|
|
||||||
soup.head.insert(1,mcharset)
|
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user