mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Courrier International
This commit is contained in:
parent
fe1eb2a2a2
commit
a0c0c43703
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '''2009, Mathieu Godlewski <mathieu at godlewski.fr>
|
__copyright__ = '2009, Mathieu Godlewski <mathieu at godlewski.fr>\
|
||||||
2014, Rémi Vanicat <vanicat at debian.org>'''
|
2014, 2015, Rémi Vanicat <vanicat at debian.org'
|
||||||
'''
|
'''
|
||||||
Courrier International
|
Courrier International
|
||||||
'''
|
'''
|
||||||
@ -25,23 +25,22 @@ class CourrierInternational(BasicNewsRecipe):
|
|||||||
html2lrf_options = ['--base-font-size', '10']
|
html2lrf_options = ['--base-font-size', '10']
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(name='div', attrs={'class':'dessin'}),
|
dict(name='div', attrs={'class':'article-content'}),
|
||||||
dict(name='div', attrs={'class':'story-content'}),
|
|
||||||
]
|
]
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name='div', attrs={'class':re.compile('story-share storylinks|pager|event-expand')}),
|
dict(name='aside', attrs={'class':re.compile('article-sitesocial|article-ad')}),
|
||||||
dict(name='li', attrs={'class':'event-partage_outils'}),
|
|
||||||
dict(name='li', attrs={'class':'story-comment-link'}),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
needs_subscription = "optional"
|
needs_subscription = "optional"
|
||||||
login_url = 'http://www.courrierinternational.com/login'
|
login_url = 'http://www.courrierinternational.com/login'
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
|
def is_form_login(form):
|
||||||
|
return "id" in form.attrs and form.attrs['id'] == "user-login-form"
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
if self.username:
|
if self.username:
|
||||||
br.open(self.login_url)
|
br.open(self.login_url)
|
||||||
br.select_form(nr=1)
|
br.select_form(predicate=is_form_login)
|
||||||
br['name'] = self.username
|
br['name'] = self.username
|
||||||
br['pass'] = self.password
|
br['pass'] = self.password
|
||||||
br.submit()
|
br.submit()
|
||||||
@ -54,23 +53,20 @@ class CourrierInternational(BasicNewsRecipe):
|
|||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
# Some articles requiring subscription fails on download.
|
# Some articles requiring subscription fails on download.
|
||||||
('A la Une', 'http://www.courrierinternational.com/rss/rss_a_la_une.xml'),
|
('Tous', 'http://www.courrierinternational.com/feed/all/rss.xml'),
|
||||||
('France', 'http://courrierint.com/rss/rp/14/0/rss.xml'),
|
# ('France', 'http://courrierint.com/rss/rp/14/0/rss.xml'),
|
||||||
('Europe', 'http://courrierint.com/rss/rp/15/0/rss.xml'),
|
# ('Europe', 'http://courrierint.com/rss/rp/15/0/rss.xml'),
|
||||||
('Amerique', 'http://courrierint.com/rss/rp/16/0/rss.xml'),
|
# ('Amerique', 'http://courrierint.com/rss/rp/16/0/rss.xml'),
|
||||||
('Asie', 'http://courrierint.com/rss/rp/17/0/rss.xml'),
|
# ('Asie', 'http://courrierint.com/rss/rp/17/0/rss.xml'),
|
||||||
('Afrique', 'http://courrierint.com/rss/rp/18/0/rss.xml'),
|
# ('Afrique', 'http://courrierint.com/rss/rp/18/0/rss.xml'),
|
||||||
('Moyen-Orient', 'http://courrierint.com/rss/rp/19/0/rss.xml'),
|
# ('Moyen-Orient', 'http://courrierint.com/rss/rp/19/0/rss.xml'),
|
||||||
('Economie', 'http://courrierint.com/rss/rp/20/0/rss.xml'),
|
# ('Economie', 'http://courrierint.com/rss/rp/20/0/rss.xml'),
|
||||||
('Multimedia', 'http://courrierint.com/rss/rp/23/0/rss.xml'),
|
# ('Multimedia', 'http://courrierint.com/rss/rp/23/0/rss.xml'),
|
||||||
('Sciences', 'http://courrierint.com/rss/rp/22/0/rss.xml'),
|
# ('Sciences', 'http://courrierint.com/rss/rp/22/0/rss.xml'),
|
||||||
('Culture', 'http://courrierint.com/rss/rp/24/0/rss.xml'),
|
# ('Culture', 'http://courrierint.com/rss/rp/24/0/rss.xml'),
|
||||||
('Insolites', 'http://courrierint.com/rss/rp/26/0/rss.xml'),
|
# ('Insolites', 'http://courrierint.com/rss/rp/26/0/rss.xml'),
|
||||||
('Cartoons', 'http://cs.courrierint.com/rss/all/rss.xml'),
|
# ('Cartoons', 'http://cs.courrierint.com/rss/all/rss.xml'),
|
||||||
('Environnement', 'http://vt.courrierint.com/rss/all/rss.xml'),
|
# ('Environnement', 'http://vt.courrierint.com/rss/all/rss.xml'),
|
||||||
('Cinema', 'http://ca.courrierint.com/rss/all/rss.xml'),
|
# ('Cinema', 'http://ca.courrierint.com/rss/all/rss.xml'),
|
||||||
('Sport', 'http://st.courrierint.com/rss/all/rss.xml'),
|
# ('Sport', 'http://st.courrierint.com/rss/all/rss.xml'),
|
||||||
]
|
]
|
||||||
|
|
||||||
def print_version(self, url):
|
|
||||||
return url + '?page=all'
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user