1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-09-11 16:22:24 +02:00

Workaround for Instagram's encrypted login. (#623)

* Workaround for Instagram's encrypted login.

Credit: https://github.com/pgrimaud/
See: 96ad4cf54d

Closes #615.

Co-authored-by: Alexander Graf <17130992+aandergr@users.noreply.github.com>
This commit is contained in:
Infinitay 2020-05-19 03:25:08 -04:00 committed by GitHub
parent 65462b01ec
commit 1a3712d112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,8 +215,11 @@ class InstaloaderContext:
session.headers.update({'X-CSRFToken': csrf_token})
# Not using self.get_json() here, because we need to access csrftoken cookie
self.do_sleep()
# Workaround credits to pgrimaud.
# See: https://github.com/pgrimaud/instagram-user-feed/commit/96ad4cf54d1ad331b337f325c73e664999a6d066
enc_password = '#PWD_INSTAGRAM_BROWSER:0:{}:{}'.format(int(datetime.now().timestamp()), passwd)
login = session.post('https://www.instagram.com/accounts/login/ajax/',
data={'password': passwd, 'username': user}, allow_redirects=True)
data={'enc_password': enc_password, 'username': user}, allow_redirects=True)
try:
resp_json = login.json()
except json.decoder.JSONDecodeError: