Put back login code for LRB since it is only open access temporarily

This commit is contained in:
Kovid Goyal 2019-12-25 19:43:19 +05:30
parent 6de56e8f93
commit 8ca694376b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -28,6 +28,7 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe):
encoding = 'utf-8'
INDEX = 'https://www.lrb.co.uk'
publication_type = 'magazine'
needs_subscription = True
requires_version = (3, 0, 0)
keep_only_tags = [
@ -38,6 +39,18 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe):
]
remove_attributes = ['width', 'height']
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username and self.password:
br.open('https://www.lrb.co.uk/login')
br.select_form(id='login_form')
br['_username'] = self.username
br['_password'] = self.password
raw = br.submit().read()
if b'>My Account<' not in raw:
raise ValueError('Failed to login check username and password')
return br
def parse_index(self):
articles = []
soup = self.index_to_soup(self.INDEX)