calibre/recipes/ledevoir.recipe
Kovid Goyal 567040ee1e Perform PEP8 compliance checks on the entire codebase
Some bits of PEP 8 are turned off via setup.cfg
2016-07-29 21:25:17 +05:30

99 lines
3.8 KiB
Plaintext

__license__ = 'GPL v3'
__author__ = 'Lorenzo Vigentini and Olivier Daigle'
__copyright__ = '2012, Lorenzo Vigentini <l.vigentini at gmail.com>, Olivier Daigle <odaigle _at nuvucameras __dot__ com>'
__version__ = 'v1.01'
__date__ = '17, March 2013'
__description__ = 'Canadian Paper '
'''
http://www.ledevoir.com/
'''
from calibre.web.feeds.news import BasicNewsRecipe
class ledevoir(BasicNewsRecipe):
author = 'Lorenzo Vigentini'
description = 'Canadian Paper. A subscription is optional, with it you get more content'
cover_url = 'http://www.ledevoir.com/images/ul/graphiques/logo_devoir.gif'
title = u'Le Devoir '
publisher = 'leDevoir.com'
category = 'News, finance, economy, politics'
language = 'fr'
encoding = 'utf-8'
timefmt = '[%a, %d %b, %Y]'
oldest_article = 1
max_articles_per_feed = 200
min_articles_per_feed = 0
use_embedded_content = False
recursion = 10
needs_subscription = 'optional'
compress_news_images = True
compress_news_images_auto_size = 4
url_list = []
remove_javascript = True
no_stylesheets = True
keep_only_tags = [
# dict(name='div', attrs={'id':'article_detail'}),
# dict(name='div', attrs={'id':'colonne_principale'}),
dict(name='article', attrs={'id': 'article', 'class': 'clearfix'}),
dict(name='article', attrs={
'id': 'article', 'class': 'clearfix portrait'})
]
remove_tags = [
dict(name='div', attrs={'id': 'prive'}),
dict(name='div', attrs={'class': 'acheter_article'}),
dict(name='div', attrs={'id': 'col_complement'}),
dict(name='div', attrs={'id': 'raccourcis', 'class': 'clearfix'}),
dict(name='div', attrs={'id': 'dialog'}),
dict(name='div', attrs={
'id': 'liste_photos_article', 'class': 'clearfix'}),
dict(name='script', attrs={'type': 'text/javascript'}),
dict(name='div', attrs={'class': ['interesse_actions', 'reactions',
'taille_du_texte right clearfix', 'partage_sociaux clearfix']}),
dict(name='aside', attrs={
'class': ['article_actions clearfix', 'partage_sociaux_wrapper']}),
dict(name='aside', attrs={'class': 'reactions', 'id': 'reactions'}),
dict(name='ul', attrs={'class': 'mots_cles'}),
dict(name='ul', attrs={'id': 'commentaires'}),
dict(name='a', attrs={'class': 'haut'}),
dict(name='h5', attrs={'class': 'interesse_actions'})
]
feeds = [
(u'A la une', 'http://www.ledevoir.com/rss/manchettes.xml'),
(u'Édition complete',
'http://feeds2.feedburner.com/fluxdudevoir'),
(u'Opinions', 'http://www.ledevoir.com/rss/opinions.xml'),
(u'Chroniques', 'http://www.ledevoir.com/rss/chroniques.xml'),
(u'Politique', 'http://www.ledevoir.com/rss/section/politique.xml?id=51'),
(u'International',
'http://www.ledevoir.com/rss/section/international.xml?id=76'),
(u'Culture', 'http://www.ledevoir.com/rss/section/culture.xml?id=48'),
(u'Environnement',
'http://www.ledevoir.com/rss/section/environnement.xml?id=78'),
(u'Societe', 'http://www.ledevoir.com/rss/section/societe.xml?id=52'),
(u'Economie', 'http://www.ledevoir.com/rss/section/economie.xml?id=49'),
(u'Sports', 'http://www.ledevoir.com/rss/section/sports.xml?id=85'),
(u'Art de vivre',
'http://www.ledevoir.com/rss/section/art-de-vivre.xml?id=50')
]
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
br.open('http://www.ledevoir.com')
br.select_form(nr=1)
br['login[courriel]'] = self.username
br['login[password]'] = self.password
br.submit()
return br