From d2423bfe8bff5f168fbe0ca2aa1c2fa352df9edc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 15 Jan 2013 10:31:11 +0530 Subject: [PATCH] Restore subscription for nytime subscription recipe --- recipes/nytimes_sub.recipe | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index df44856293..35f7b46517 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -124,19 +124,19 @@ class NYTimes(BasicNewsRecipe): if headlinesOnly: title='New York Times Headlines' description = 'Headlines from the New York Times' - needs_subscription = False + needs_subscription = True elif webEdition: title='New York Times (Web)' description = 'New York Times on the Web' - needs_subscription = False + needs_subscription = True elif replaceKindleVersion: title='The New York Times' description = 'Today\'s New York Times' - needs_subscription = False + needs_subscription = True else: title='New York Times' description = 'Today\'s New York Times' - needs_subscription = False + needs_subscription = True def decode_url_date(self,url): urlitems = url.split('/') @@ -359,6 +359,14 @@ class NYTimes(BasicNewsRecipe): def get_browser(self): br = BasicNewsRecipe.get_browser() + if self.username is not None and self.password is not None: + br.open('http://www.nytimes.com/auth/login') + br.form = br.forms().next() + br['userid'] = self.username + br['password'] = self.password + raw = br.submit().read() + if 'Please try again' in raw: + raise Exception('Your username and password are incorrect') return br cover_tag = 'NY_NYT'