您好,我正在尝试通过请求登录instagram,并已这样做。发布数据后,我得到如下所示的“需要挑战”响应:
b'{"message": "challenge_required", "challenge": {"url": "https://i.instagram.com/challenge/935162/Pp9fvRmVZ4/", "api_path": "/challenge/935162/Pp9fvRmVZ4/", "hide_webview_header": true, "lock": true, "logout": false, "native_flow": true}, "status": "fail", "error_type": "checkpoint_challenge_required"}'
如您所见,有一个新的instagram url而不是登录名,我想解析该新url,然后为挑战输入我的新有效负载,这是一个代码。我该怎么做?
编辑: 我解析了json并接受了新的网址,但它没有说明我是否通过了要求的挑战:
r = requests.post("https://i.instagram.com/api/v1/accounts/login/", data=Payload, headers=headers)
j = r.json() # converts the response to a dictionary
url2 = j['challenge']['url']
requests.post(url=url2, data=sus_code, headers=headers)
print(r.content)
那是我的代码,谢谢。