1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 12:42:29 +01:00

[newgrounds] access 'response.text' only once

This commit is contained in:
Mike Fährmann 2023-07-04 21:49:57 +02:00
parent 9576652fa5
commit a16d7c59cb
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -87,16 +87,15 @@ class NewgroundsExtractor(Extractor):
if response.history and response.url.endswith("/social"):
return self.session.cookies
page = response.text
headers = {"Origin": self.root, "Referer": url}
url = text.urljoin(self.root, text.extr(
response.text, 'action="', '"'))
auth_token = text.extr(response.text, 'name="auth" value="', '"')
url = text.urljoin(self.root, text.extr(page, 'action="', '"'))
data = {
"username": username,
"password": password,
"remember": "1",
"login" : "1",
"auth" : auth_token
"auth" : text.extr(page, 'name="auth" value="', '"'),
}
response = self.request(url, method="POST", headers=headers, data=data)