1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-07-04 10:57:58 +02:00

attempt to fix 2FA

This commit is contained in:
Alexander Graf 2023-10-16 08:44:40 +02:00
parent ac28a33b4d
commit 4022e7fae7

View File

@ -253,7 +253,7 @@ class InstaloaderContext:
'ig_vw': '1920', 'ig_cb': '1', 'csrftoken': '',
's_network': '', 'ds_user_id': ''})
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/")
# Override default timeout behavior.
# 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.")
(session, user, two_factor_id) = self.two_factor_auth_pending
login = session.post('https://www.instagram.com/accounts/login/ajax/two_factor/',
data={'username': user, 'verificationCode': two_factor_code, 'identifier': two_factor_id},
login = session.post('https://www.instagram.com/api/v1/web/accounts/login/ajax/two_factor/',
data={
'identifier': two_factor_id,
'queryParams': '{"next":"/"}',
'trust_signal': 'true',
'username': user,
'verification_method': '1',
'verificationCode': two_factor_code,
},
allow_redirects=True)
resp_json = login.json()
if resp_json['status'] != 'ok':