mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Change the way to address login form
Access the login form via its property "id" instead of its (changing) position, as it's not possible to use its name (this form has no name)
This commit is contained in:
parent
692c3297aa
commit
4fb5580990
@ -144,10 +144,12 @@ class Mediapart(BasicNewsRecipe):
|
||||
|
||||
# -- Handle login
|
||||
def get_browser(self):
|
||||
def is_form_login(form):
|
||||
return "id" in form.attrs and form.attrs['id'] == "logFormEl"
|
||||
br = BasicNewsRecipe.get_browser(self)
|
||||
if self.username is not None and self.password is not None:
|
||||
br.open('https://www.mediapart.fr/login')
|
||||
br.select_form(nr=2)
|
||||
br.select_form(predicate=is_form_login)
|
||||
br['name'] = self.username
|
||||
br['password'] = self.password
|
||||
br.submit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user