[newgrounds] only login if necessary (#2715)
This commit is contained in:
@@ -72,6 +72,8 @@ class NewgroundsExtractor(Extractor):
|
|||||||
"""Return general metadata"""
|
"""Return general metadata"""
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
|
if self._check_cookies(self.cookienames):
|
||||||
|
return
|
||||||
username, password = self._get_auth_info()
|
username, password = self._get_auth_info()
|
||||||
if username:
|
if username:
|
||||||
self._update_cookies(self._login_impl(username, password))
|
self._update_cookies(self._login_impl(username, password))
|
||||||
@@ -81,10 +83,13 @@ class NewgroundsExtractor(Extractor):
|
|||||||
self.log.info("Logging in as %s", username)
|
self.log.info("Logging in as %s", username)
|
||||||
|
|
||||||
url = self.root + "/passport/"
|
url = self.root + "/passport/"
|
||||||
page = self.request(url).text
|
response = self.request(url)
|
||||||
headers = {"Origin": self.root, "Referer": url}
|
if response.history and response.url.endswith("/social"):
|
||||||
|
return self.session.cookies
|
||||||
|
|
||||||
url = text.urljoin(self.root, text.extract(page, 'action="', '"')[0])
|
headers = {"Origin": self.root, "Referer": url}
|
||||||
|
url = text.urljoin(self.root, text.extract(
|
||||||
|
response.text, 'action="', '"')[0])
|
||||||
data = {
|
data = {
|
||||||
"username": username,
|
"username": username,
|
||||||
"password": password,
|
"password": password,
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
__version__ = "1.22.3"
|
__version__ = "1.22.4-dev"
|
||||||
|
|||||||
Reference in New Issue
Block a user