diff --git a/recipes/financial_times.recipe b/recipes/financial_times.recipe index 5ebe84c313..38f32e35df 100644 --- a/recipes/financial_times.recipe +++ b/recipes/financial_times.recipe @@ -1,3 +1,5 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 __license__ = 'GPL v3' __copyright__ = '2010-2011, Darko Miletic ' ''' @@ -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') ] diff --git a/recipes/financial_times_uk.recipe b/recipes/financial_times_uk.recipe index 39d68c0a7c..7d0087aedb 100644 --- a/recipes/financial_times_uk.recipe +++ b/recipes/financial_times_uk.recipe @@ -1,5 +1,9 @@ +#!/usr/bin/env python2 +# -*- mode: python -*- +# -*- coding: utf-8 -*- + __license__ = 'GPL v3' -__copyright__ = '2010-2015, Darko Miletic ' +__copyright__ = '2010-2017, Darko Miletic ' ''' 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) diff --git a/recipes/financial_times_us.recipe b/recipes/financial_times_us.recipe index 4fc1b4e59c..6b6c8338a9 100644 --- a/recipes/financial_times_us.recipe +++ b/recipes/financial_times_us.recipe @@ -1,5 +1,9 @@ +#!/usr/bin/env python2 +# -*- mode: python -*- +# -*- coding: utf-8 -*- + __license__ = 'GPL v3' -__copyright__ = '2010-2015, Darko Miletic ' +__copyright__ = '2010-2017, Darko Miletic ' ''' 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)