Fix changed form name on FT login page

This commit is contained in:
Kovid Goyal 2017-02-22 07:43:08 +05:30
parent 664da9368c
commit c81ac9e9b9
3 changed files with 19 additions and 18 deletions

View File

@ -31,22 +31,23 @@ class FinancialTimes_rss(BasicNewsRecipe):
remove_empty_feeds = True remove_empty_feeds = True
publication_type = 'newspaper' publication_type = 'newspaper'
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://accounts.ft.com/login' handle_gzip = True
INDEX = 'http://www.ft.com' LOGIN = 'https://www.ft.com/login?location=/'
INDEX = 'https://www.ft.com'
def get_browser(self): def get_browser(self):
br = BasicNewsRecipe.get_browser(self) br = BasicNewsRecipe.get_browser(self)
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='login') br.select_form(name='enter-email-form')
br['email'] = self.username br['email'] = self.username
br['password'] = self.password br['password'] = self.password
br.submit() br.submit()
return br return br
keep_only_tags = [ keep_only_tags = [
classes('article__header--wrapper article__time-byline article__body n-content-image') classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
] ]
remove_tags = [ remove_tags = [
@ -56,10 +57,10 @@ class FinancialTimes_rss(BasicNewsRecipe):
remove_attributes = ['width', 'height', 'lang', 'style'] remove_attributes = ['width', 'height', 'lang', 'style']
feeds = [ feeds = [
(u'UK', u'http://www.ft.com/rss/home/uk'), (u'UK', u'https://www.ft.com/rss/home/uk'),
(u'US', u'http://www.ft.com/rss/home/us'), (u'US', u'https://www.ft.com/rss/home/us'),
(u'Asia', u'http://www.ft.com/rss/home/asia'), (u'Asia', u'https://www.ft.com/rss/home/asia'),
(u'Middle East', u'http://www.ft.com/rss/home/middleeast') (u'Middle East', u'https://www.ft.com/rss/home/middleeast')
] ]
def preprocess_html(self, soup): def preprocess_html(self, soup):

View File

@ -29,12 +29,12 @@ class FinancialTimes(BasicNewsRecipe):
needs_subscription = True needs_subscription = True
encoding = 'utf8' encoding = 'utf8'
publication_type = 'newspaper' publication_type = 'newspaper'
LOGIN = 'https://accounts.ft.com/login?location=http%3A%2F%2Fwww.ft.com%2Fhome%2Fuk' handle_gzip = True
INDEX = 'http://www.ft.com/uk-edition' LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
PREFIX = 'http://www.ft.com' INDEX = 'https://www.ft.com/uk-edition'
keep_only_tags = [ keep_only_tags = [
classes('article__header--wrapper article__time-byline article__body n-content-image') classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
] ]
remove_tags = [ remove_tags = [
@ -48,7 +48,7 @@ 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='login') br.select_form(name='enter-email-form')
br['email'] = self.username br['email'] = self.username
br['password'] = self.password br['password'] = self.password
br.submit() br.submit()

View File

@ -29,12 +29,12 @@ class FinancialTimes(BasicNewsRecipe):
needs_subscription = True needs_subscription = True
encoding = 'utf8' encoding = 'utf8'
publication_type = 'newspaper' publication_type = 'newspaper'
LOGIN = 'https://accounts.ft.com/login?location=http%3A%2F%2Fwww.ft.com%2Fhome%2Fuk' handle_gzip = True
INDEX = 'http://www.ft.com/international-edition' LOGIN = 'https://accounts.ft.com/login?location=https%3A%2F%2Fwww.ft.com%2Fhome%2Fuk'
PREFIX = 'http://www.ft.com' INDEX = 'https://www.ft.com/international-edition'
keep_only_tags = [ keep_only_tags = [
classes('article__header--wrapper article__time-byline article__body n-content-image') classes('article__header--wrapper article__time-byline article__body n-content-image barrier-grid__heading')
] ]
remove_tags = [ remove_tags = [
@ -48,7 +48,7 @@ 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='login') br.select_form(name='enter-email-form')
br['email'] = self.username br['email'] = self.username
br['password'] = self.password br['password'] = self.password
br.submit() br.submit()