@@ -24,7 +24,7 @@ class NewgroundsExtractor(Extractor):
2424 archive_fmt = "{_type}{_index}"
2525 root = "https://www.newgrounds.com"
2626 cookies_domain = ".newgrounds.com"
27- cookies_names = ("NG_GG_username" , "vmk1du5I8m" )
27+ cookies_names = ("ng_session" , )
2828 request_interval = (0.5 , 1.5 )
2929
3030 def __init__ (self , match ):
@@ -111,7 +111,7 @@ def login(self):
111111 def _login_impl (self , username , password ):
112112 self .log .info ("Logging in as %s" , username )
113113
114- url = self .root + "/passport "
114+ url = self .root + "/login "
115115 response = self .request (url )
116116 if response .history and response .url .endswith ("/social" ):
117117 return self .cookies
@@ -124,38 +124,18 @@ def _login_impl(self, username, password):
124124 "Origin" : self .root ,
125125 "Referer" : url ,
126126 }
127- url = text .urljoin (self .root , text .extr (page , 'action="' , '"' ))
128127 data = {
129- "auth " : text .extr (page , 'name="auth " value="' , '"' ),
128+ "_token " : text .extr (page , 'name="_token " value="' , '"' ),
130129 "remember" : "1" ,
131- "username " : username ,
130+ "identity " : username ,
132131 "password" : str (password ),
133- "code" : "" ,
134- "codehint" : "------" ,
135- "mfaCheck" : "1" ,
136132 }
137133
138- while True :
134+ try :
139135 response = self .request (
140136 url , method = "POST" , headers = headers , data = data )
141- result = response .json ()
142-
143- if result .get ("success" ):
144- break
145- if "errors" in result :
146- raise self .exc .AuthenticationError (
147- '"' + '", "' .join (result ["errors" ]) + '"' )
148-
149- if result .get ("requiresMfa" ):
150- data ["code" ] = self .input ("Verification Code: " )
151- data ["codehint" ] = " "
152- elif result .get ("requiresEmailMfa" ):
153- email = result .get ("obfuscatedEmail" )
154- prompt = f"Email Verification Code ({ email } ): "
155- data ["code" ] = self .input (prompt )
156- data ["codehint" ] = " "
157-
158- data .pop ("mfaCheck" , None )
137+ except Exception :
138+ raise self .exc .AuthenticationError ()
159139
160140 return {
161141 cookie .name : cookie .value
0 commit comments