mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Put back login code for LRB since it is only open access temporarily
This commit is contained in:
parent
6de56e8f93
commit
8ca694376b
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user