mirror of
https://github.com/instaloader/instaloader.git
synced 2024-10-03 22:07:11 +02:00
attempt to fix 2FA
This commit is contained in:
parent
ac28a33b4d
commit
4022e7fae7
@ -253,7 +253,7 @@ class InstaloaderContext:
|
|||||||
'ig_vw': '1920', 'ig_cb': '1', 'csrftoken': '',
|
'ig_vw': '1920', 'ig_cb': '1', 'csrftoken': '',
|
||||||
's_network': '', 'ds_user_id': ''})
|
's_network': '', 'ds_user_id': ''})
|
||||||
session.headers.update(self._default_http_header())
|
session.headers.update(self._default_http_header())
|
||||||
#Getting mid cookie value
|
# Getting mid cookie value
|
||||||
session.get("https://i.instagram.com/api/v1/web/login_page/")
|
session.get("https://i.instagram.com/api/v1/web/login_page/")
|
||||||
# Override default timeout behavior.
|
# Override default timeout behavior.
|
||||||
# Need to silence mypy bug for this. See: https://github.com/python/mypy/issues/2427
|
# Need to silence mypy bug for this. See: https://github.com/python/mypy/issues/2427
|
||||||
@ -327,8 +327,15 @@ class InstaloaderContext:
|
|||||||
raise InvalidArgumentException("No two-factor authentication pending.")
|
raise InvalidArgumentException("No two-factor authentication pending.")
|
||||||
(session, user, two_factor_id) = self.two_factor_auth_pending
|
(session, user, two_factor_id) = self.two_factor_auth_pending
|
||||||
|
|
||||||
login = session.post('https://www.instagram.com/accounts/login/ajax/two_factor/',
|
login = session.post('https://www.instagram.com/api/v1/web/accounts/login/ajax/two_factor/',
|
||||||
data={'username': user, 'verificationCode': two_factor_code, 'identifier': two_factor_id},
|
data={
|
||||||
|
'identifier': two_factor_id,
|
||||||
|
'queryParams': '{"next":"/"}',
|
||||||
|
'trust_signal': 'true',
|
||||||
|
'username': user,
|
||||||
|
'verification_method': '1',
|
||||||
|
'verificationCode': two_factor_code,
|
||||||
|
},
|
||||||
allow_redirects=True)
|
allow_redirects=True)
|
||||||
resp_json = login.json()
|
resp_json = login.json()
|
||||||
if resp_json['status'] != 'ok':
|
if resp_json['status'] != 'ok':
|
||||||
|
Loading…
Reference in New Issue
Block a user