calibre/recipes/dhnet_be.recipe
Kovid Goyal 29cd8d64ea
Change shebangs to python from python2
Also remove a few other miscellaneous references to python2
2020-08-22 18:47:51 +05:30

49 lines
1.4 KiB
Python

#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008-2011, Lionel Bergeret <lbergeret at gmail.com>'
'''
dhnet.be
'''
from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe
class DHNetBe(BasicNewsRecipe):
title = u'La Derniere Heure'
__author__ = u'Lionel Bergeret'
description = u'News from Belgium in French'
publisher = u'dhnet.be'
category = 'news, Belgium'
oldest_article = 3
language = 'fr'
masthead_url = 'http://www.dhnet.be/images/homepage_logo_dh.gif'
max_articles_per_feed = 20
no_stylesheets = True
use_embedded_content = False
timefmt = ' [%d %b %Y]'
keep_only_tags = [
dict(name='div', attrs={'id': 'articleText'}), dict(
name='div', attrs={'id': 'articlePicureAndLinks'})
]
feeds = [
(u'La Une', u'http://www.dhnet.be/rss'), (u'La Une Sports',
u'http://www.dhnet.be/rss/dhsports/'), (u'La Une Info', u'http://www.dhnet.be/rss/dhinfos/')
]
def preprocess_html(self, soup):
for alink in soup.findAll('a'):
if alink.string is not None:
tstr = alink.string
alink.replaceWith(tstr)
return soup
def get_cover_url(self):
cover_url = strftime(
'http://pdf-online.dhnet.be/pdfonline/image/%Y%m%d/dh_%Y%m%d_nam_infoge_001.pdf.L.jpg')
return cover_url