From 8c050a4355bbcb2b734247ce92072aaac8add2a9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 25 Aug 2012 14:42:36 +0530 Subject: [PATCH] Update Time --- recipes/time_magazine.recipe | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/recipes/time_magazine.recipe b/recipes/time_magazine.recipe index cbe40f79f2..dfe897500e 100644 --- a/recipes/time_magazine.recipe +++ b/recipes/time_magazine.recipe @@ -19,7 +19,7 @@ class Time(BasicNewsRecipe): no_stylesheets = True language = 'en' remove_javascript = True - needs_subscription = 'optional' + needs_subscription = True keep_only_tags = [ { @@ -40,7 +40,7 @@ class Time(BasicNewsRecipe): def get_browser(self): br = BasicNewsRecipe.get_browser(self) # This site uses javascript in its login process - if False and 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('http://www.time.com/time/magazine') br.select_form(predicate=lambda f: 'action' in f.attrs and f.attrs['action'] == 'https://auth.time.com/login.php') br['username'] = self.username @@ -52,7 +52,10 @@ class Time(BasicNewsRecipe): br['rurl'] = 'http://www.time.com/time/magazine' br['remember'] = False raw = br.submit().read() - if '>Log Out<' not in raw: + if False and '>Log Out<' not in raw: + # This check is disabled as it does not work (there is probably + # some cookie missing) however, the login is "sufficient" for + # the actual article downloads to work. raise ValueError('Failed to login to time.com, check' ' your username and password') return br @@ -101,8 +104,7 @@ class Time(BasicNewsRecipe): method='text').strip() if not title: continue url = a[0].get('href') - # url = re.sub('/magazine/article/0,9171','/subscriber/printout/0,8816', - # url) + url = re.sub('/magazine/article/0,9171','/subscriber/printout/0,8816', url) if url.startswith('/'): url = 'http://www.time.com'+url desc = ''