File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66:copyright: (c) 2019 python273
77"""
88
9+ import json
910import logging
1011import random
1112import re
@@ -329,14 +330,19 @@ def _pass_twofactor(self, auth_response):
329330 }
330331
331332 response = self .http .post ('https://vk.com/al_login.php' , values )
332- response_parsed = response .text .split ('<!>' )
333+ data = json .loads (response .text .lstrip ('<!--' ))
334+ status = data ['payload' ][0 ]
333335
334- if response_parsed [4 ] == '4' : # OK
335- return self .http .get ('https://vk.com/' + response_parsed [5 ])
336+ if status == '4' : # OK
337+ path = json .loads (data ['payload' ][1 ][0 ])
338+ return self .http .get ('https://vk.com' + path )
336339
337- elif response_parsed [ 4 ] == '8' : # Incorrect code
340+ elif status in [ 0 , '8' ] : # Incorrect code
338341 return self ._pass_twofactor (auth_response )
339342
343+ elif status == '2' :
344+ raise TwoFactorError ('Recaptcha required' )
345+
340346 raise TwoFactorError ('Two factor authentication failed' )
341347
342348 def _pass_security_check (self , response = None ):
You can’t perform that action at this time.
0 commit comments