From 0c6c53161efda1c3a96787206544015a81ee159c Mon Sep 17 00:00:00 2001 From: Alexander Bareyko <30691647+energizer91@users.noreply.github.com> Date: Tue, 1 Nov 2022 20:25:12 +0100 Subject: [PATCH] Fix api.py according to new Instagram API format Currently Instagram returns `csrf_token` inside nested object called `config`. These changes fix it. --- pyinstalive/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyinstalive/api.py b/pyinstalive/api.py index b90ee20..7906bdc 100644 --- a/pyinstalive/api.py +++ b/pyinstalive/api.py @@ -7,7 +7,7 @@ def get_csrf_token(): response = globals.session.session.get(Constants.LOGIN_PAGE) - return helpers.get_shared_data(response.text).get("csrf_token", None) + return helpers.get_shared_data(response.text).get("config", None).get("csrf_token", None) def do_login(): now_epoch = int(datetime.now().timestamp()) @@ -46,4 +46,4 @@ def get_stream_data(): def do_heartbeat(): response = globals.session.session.post(Constants.LIVE_HEARTBEAT.format(globals.download.livestream_object_init.get('id')), timeout=5) - return json.loads(response.text) \ No newline at end of file + return json.loads(response.text)