Update Financial Times. Fixes #1529141 [Financial Times UK and Interantional edition not working](https://bugs.launchpad.net/calibre/+bug/1529141)

This commit is contained in:
Kovid Goyal 2015-12-25 08:03:34 +05:30
parent 2b3a1ea10c
commit 21ed07d178
4 changed files with 17 additions and 15 deletions

View File

@ -1,7 +1,7 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010-2014, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2010-2015, Darko Miletic <darko.miletic at gmail.com>'
''' '''
www.ft.com/intl/uk-edition www.ft.com/uk-edition
''' '''
from calibre.ptempfile import PersistentTemporaryFile from calibre.ptempfile import PersistentTemporaryFile
@ -25,9 +25,8 @@ class FinancialTimes(BasicNewsRecipe):
articles_are_obfuscated = True articles_are_obfuscated = True
temp_files = [] temp_files = []
masthead_url = 'http://im.media.ft.com/m/img/masthead_main.jpg' masthead_url = 'http://im.media.ft.com/m/img/masthead_main.jpg'
LOGIN = 'https://registration.ft.com/registration/barrier/login' LOGIN = 'https://accounts.ft.com/login?location=http%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
LOGIN2 = 'http://media.ft.com/h/subs3.html' INDEX = 'http://www.ft.com/uk-edition'
INDEX = 'http://www.ft.com/intl/uk-edition'
PREFIX = 'http://www.ft.com' PREFIX = 'http://www.ft.com'
def get_browser(self): def get_browser(self):
@ -35,8 +34,8 @@ class FinancialTimes(BasicNewsRecipe):
br.open(self.INDEX) br.open(self.INDEX)
if self.username is not None and self.password is not None: if self.username is not None and self.password is not None:
br.open(self.LOGIN) br.open(self.LOGIN)
br.select_form(name='loginForm') br.select_form(name='login')
br['username'] = self.username br['email' ] = self.username
br['password'] = self.password br['password'] = self.password
br.submit() br.submit()
return br return br
@ -48,7 +47,9 @@ class FinancialTimes(BasicNewsRecipe):
dict(name='div', attrs={'id':'floating-con'}), dict(name='div', attrs={'id':'floating-con'}),
dict(name=['meta','iframe','base','object','embed','link']), dict(name=['meta','iframe','base','object','embed','link']),
dict(attrs={'class':['storyTools','story-package','screen-copy','story-package separator','expandable-image','promobox']}), dict(attrs={'class':['storyTools','story-package','screen-copy','story-package separator','expandable-image','promobox']}),
dict(name='div', attrs={'class':lambda x: x and 'insideArticleRelatedTopics' in x.split()}) dict(name='div', attrs={'class':lambda x: x and 'insideArticleRelatedTopics' in x.split()}),
dict(name='div', attrs={'class':lambda x: x and 'ft-new-story-tools-box' in x.split()}),
dict(name='div', attrs={'class':['railMiniVideo','ftbf-syndicationIndicator']})
] ]
remove_attributes = ['width','height','lang'] remove_attributes = ['width','height','lang']

View File

@ -1,7 +1,7 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010-2013, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2010-2015, Darko Miletic <darko.miletic at gmail.com>'
''' '''
www.ft.com/intl/international-edition www.ft.com/international-edition
''' '''
from calibre.ptempfile import PersistentTemporaryFile from calibre.ptempfile import PersistentTemporaryFile
@ -26,9 +26,8 @@ class FinancialTimes(BasicNewsRecipe):
articles_are_obfuscated = True articles_are_obfuscated = True
temp_files = [] temp_files = []
masthead_url = 'http://im.media.ft.com/m/img/masthead_main.jpg' masthead_url = 'http://im.media.ft.com/m/img/masthead_main.jpg'
LOGIN = 'https://registration.ft.com/registration/barrier/login' LOGIN = 'https://accounts.ft.com/login?location=http%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
LOGIN2 = 'http://media.ft.com/h/subs3.html' INDEX = 'http://www.ft.com/international-edition'
INDEX = 'http://www.ft.com/intl/international-edition'
PREFIX = 'http://www.ft.com' PREFIX = 'http://www.ft.com'
conversion_options = { conversion_options = {
@ -44,8 +43,8 @@ class FinancialTimes(BasicNewsRecipe):
br.open(self.INDEX) br.open(self.INDEX)
if self.username is not None and self.password is not None: if self.username is not None and self.password is not None:
br.open(self.LOGIN) br.open(self.LOGIN)
br.select_form(name='loginForm') br.select_form(name='login')
br['username'] = self.username br['email' ] = self.username
br['password'] = self.password br['password'] = self.password
br.submit() br.submit()
return br return br
@ -58,6 +57,8 @@ class FinancialTimes(BasicNewsRecipe):
,dict(name=['meta','iframe','base','object','embed','link']) ,dict(name=['meta','iframe','base','object','embed','link'])
,dict(attrs={'class':['storyTools','story-package','screen-copy','story-package separator','expandable-image','promobox']}) ,dict(attrs={'class':['storyTools','story-package','screen-copy','story-package separator','expandable-image','promobox']})
,dict(name='div', attrs={'class':lambda x: x and 'insideArticleRelatedTopics' in x.split()}) ,dict(name='div', attrs={'class':lambda x: x and 'insideArticleRelatedTopics' in x.split()})
,dict(name='div', attrs={'class':lambda x: x and 'ft-new-story-tools-box' in x.split()})
,dict(name='div', attrs={'class':['railMiniVideo','ftbf-syndicationIndicator']})
] ]
remove_attributes = ['width','height','lang'] remove_attributes = ['width','height','lang']

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 391 B