mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Financial Times
Fixes #1666609 [Financial Times download broken](https://bugs.launchpad.net/calibre/+bug/1666609)
This commit is contained in:
parent
e79cb5ba79
commit
0a2291ae06
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
@ -34,6 +36,7 @@ class FinancialTimes_rss(BasicNewsRecipe):
|
|||||||
handle_gzip = True
|
handle_gzip = True
|
||||||
LOGIN = 'https://www.ft.com/login?location=/'
|
LOGIN = 'https://www.ft.com/login?location=/'
|
||||||
INDEX = 'https://www.ft.com'
|
INDEX = 'https://www.ft.com'
|
||||||
|
LOGOUT = 'https://myaccount.ft.com/logout'
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
@ -42,10 +45,15 @@ class FinancialTimes_rss(BasicNewsRecipe):
|
|||||||
br.open(self.LOGIN)
|
br.open(self.LOGIN)
|
||||||
br.select_form(name='enter-email-form')
|
br.select_form(name='enter-email-form')
|
||||||
br['email'] = self.username
|
br['email'] = self.username
|
||||||
|
br.submit()
|
||||||
|
br.select_form(name='enter-password-form')
|
||||||
br['password'] = self.password
|
br['password'] = self.password
|
||||||
br.submit()
|
br.submit()
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
self.browser.open(self.LOGOUT)
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
|
classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
|
||||||
]
|
]
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*- mode: python -*-
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__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
|
www.ft.com/uk-edition
|
||||||
'''
|
'''
|
||||||
@ -30,8 +34,10 @@ class FinancialTimes(BasicNewsRecipe):
|
|||||||
encoding = 'utf8'
|
encoding = 'utf8'
|
||||||
publication_type = 'newspaper'
|
publication_type = 'newspaper'
|
||||||
handle_gzip = True
|
handle_gzip = True
|
||||||
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
|
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2F'
|
||||||
INDEX = 'https://www.ft.com/uk-edition'
|
LOGOUT = 'https://myaccount.ft.com/logout'
|
||||||
|
INDEX = 'http://www.ft.com/uk-edition'
|
||||||
|
PREFIX = 'http://www.ft.com'
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
|
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.open(self.LOGIN)
|
||||||
br.select_form(name='enter-email-form')
|
br.select_form(name='enter-email-form')
|
||||||
br['email'] = self.username
|
br['email'] = self.username
|
||||||
|
br.submit()
|
||||||
|
br.select_form(name='enter-password-form')
|
||||||
br['password'] = self.password
|
br['password'] = self.password
|
||||||
br.submit()
|
br.submit()
|
||||||
return br
|
return br
|
||||||
@ -89,3 +97,6 @@ class FinancialTimes(BasicNewsRecipe):
|
|||||||
src = unquote(src.rpartition('/')[2].partition('?')[0])
|
src = unquote(src.rpartition('/')[2].partition('?')[0])
|
||||||
img['src'] = src
|
img['src'] = src
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
self.browser.open(self.LOGOUT)
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*- mode: python -*-
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__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
|
www.ft.com/international-edition
|
||||||
'''
|
'''
|
||||||
@ -30,8 +34,10 @@ class FinancialTimes(BasicNewsRecipe):
|
|||||||
encoding = 'utf8'
|
encoding = 'utf8'
|
||||||
publication_type = 'newspaper'
|
publication_type = 'newspaper'
|
||||||
handle_gzip = True
|
handle_gzip = True
|
||||||
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
|
LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2F'
|
||||||
INDEX = 'https://www.ft.com/international-edition'
|
LOGOUT = 'https://myaccount.ft.com/logout'
|
||||||
|
INDEX = 'http://www.ft.com/international-edition'
|
||||||
|
PREFIX = 'http://www.ft.com'
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
|
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.open(self.LOGIN)
|
||||||
br.select_form(name='enter-email-form')
|
br.select_form(name='enter-email-form')
|
||||||
br['email'] = self.username
|
br['email'] = self.username
|
||||||
|
br.submit()
|
||||||
|
br.select_form(name='enter-password-form')
|
||||||
br['password'] = self.password
|
br['password'] = self.password
|
||||||
br.submit()
|
br.submit()
|
||||||
return br
|
return br
|
||||||
@ -85,3 +93,6 @@ class FinancialTimes(BasicNewsRecipe):
|
|||||||
src = unquote(src.rpartition('/')[2].partition('?')[0])
|
src = unquote(src.rpartition('/')[2].partition('?')[0])
|
||||||
img['src'] = src
|
img['src'] = src
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
self.browser.open(self.LOGOUT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user