Update London Review of Books

This commit is contained in:
Kovid Goyal 2018-02-01 16:28:30 +05:30
parent 6a9096d6d8
commit e036bc9a76
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -20,7 +20,7 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe):
delay = 1 delay = 1
use_embedded_content = False use_embedded_content = False
encoding = 'utf-8' encoding = 'utf-8'
INDEX = 'http://www.lrb.co.uk' INDEX = 'https://www.lrb.co.uk'
LOGIN = INDEX + '/login' LOGIN = INDEX + '/login'
masthead_url = INDEX + '/assets/images/lrb_logo_big.gif' masthead_url = INDEX + '/assets/images/lrb_logo_big.gif'
needs_subscription = True needs_subscription = True
@ -31,10 +31,12 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe):
br = BasicNewsRecipe.get_browser(self) br = BasicNewsRecipe.get_browser(self)
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(nr=1) br.select_form(action='/login')
br['username'] = self.username br['username'] = self.username
br['password'] = self.password br['password'] = self.password
br.submit() raw = br.submit().read()
if 'You are logged in as' not in raw:
raise ValueError('Failed to log in, check username and password')
return br return br
def parse_index(self): def parse_index(self):