Update Financial Times

Fixes #1666609 [Financial Times download broken](https://bugs.launchpad.net/calibre/+bug/1666609)
This commit is contained in:
Kovid Goyal 2017-02-24 08:00:22 +05:30
parent e79cb5ba79
commit 0a2291ae06
3 changed files with 36 additions and 6 deletions

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python2
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>'
'''
@ -34,6 +36,7 @@ class FinancialTimes_rss(BasicNewsRecipe):
handle_gzip = True
LOGIN = 'https://www.ft.com/login?location=/'
INDEX = 'https://www.ft.com'
LOGOUT = 'https://myaccount.ft.com/logout'
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
@ -42,10 +45,15 @@ class FinancialTimes_rss(BasicNewsRecipe):
br.open(self.LOGIN)
br.select_form(name='enter-email-form')
br['email'] = self.username
br.submit()
br.select_form(name='enter-password-form')
br['password'] = self.password
br.submit()
return br
def cleanup(self):
self.browser.open(self.LOGOUT)
keep_only_tags = [
classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
]

View File

@ -1,5 +1,9 @@
#!/usr/bin/env python2
# -*- mode: python -*-
# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = '2010-2015, Darko Miletic <darko.miletic at gmail.com>'
__copyright__ = '2010-2017, Darko Miletic <darko.miletic at gmail.com>'
'''
www.ft.com/uk-edition
'''
@ -30,8 +34,10 @@ class FinancialTimes(BasicNewsRecipe):
encoding = 'utf8'
publication_type = 'newspaper'
handle_gzip = True
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
INDEX = 'https://www.ft.com/uk-edition'
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2F'
LOGOUT = 'https://myaccount.ft.com/logout'
INDEX = 'http://www.ft.com/uk-edition'
PREFIX = 'http://www.ft.com'
keep_only_tags = [
classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
@ -50,6 +56,8 @@ class FinancialTimes(BasicNewsRecipe):
br.open(self.LOGIN)
br.select_form(name='enter-email-form')
br['email'] = self.username
br.submit()
br.select_form(name='enter-password-form')
br['password'] = self.password
br.submit()
return br
@ -89,3 +97,6 @@ class FinancialTimes(BasicNewsRecipe):
src = unquote(src.rpartition('/')[2].partition('?')[0])
img['src'] = src
return soup
def cleanup(self):
self.browser.open(self.LOGOUT)

View File

@ -1,5 +1,9 @@
#!/usr/bin/env python2
# -*- mode: python -*-
# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = '2010-2015, Darko Miletic <darko.miletic at gmail.com>'
__copyright__ = '2010-2017, Darko Miletic <darko.miletic at gmail.com>'
'''
www.ft.com/international-edition
'''
@ -30,8 +34,10 @@ class FinancialTimes(BasicNewsRecipe):
encoding = 'utf8'
publication_type = 'newspaper'
handle_gzip = True
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
INDEX = 'https://www.ft.com/international-edition'
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2F'
LOGOUT = 'https://myaccount.ft.com/logout'
INDEX = 'http://www.ft.com/international-edition'
PREFIX = 'http://www.ft.com'
keep_only_tags = [
classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
@ -50,6 +56,8 @@ class FinancialTimes(BasicNewsRecipe):
br.open(self.LOGIN)
br.select_form(name='enter-email-form')
br['email'] = self.username
br.submit()
br.select_form(name='enter-password-form')
br['password'] = self.password
br.submit()
return br
@ -85,3 +93,6 @@ class FinancialTimes(BasicNewsRecipe):
src = unquote(src.rpartition('/')[2].partition('?')[0])
img['src'] = src
return soup
def cleanup(self):
self.browser.open(self.LOGOUT)