I'm trying to download the saved pictures/videos on my Instagram account. I've tried using my user/password both with config.json, double checking if they were correct and trying with different acocunts, but they all amounted to the same error message:
[instagram][error] HttpError: '400 Bad Request' for 'https://www.instagram.com/accounts/login/ajax/'
Is there something wrong on Instagram side? Is there anything else besides adding the password to the command/json file that needs to be done?
My gallery-dl.config is like so:
```
{
"extractor": {
"base-directory": "C:\Users\user\Pictures\_saved",
"postprocessors": null,
"skip": true,
"sleep": 0,
"path-restrict": "auto",
"path-remove": "\u0000-\u001f\u007f",
"oauth": {
"browser": true,
"port": 6414
},
"reactor": {
"wait-min": 3,
"wait-max": 6
},
"recursive": {
"blacklist": ["directlink", "oauth", "recursive", "test"]
},
"twitter": {
"filename": "{user[name]} - {content[0:200]}.{extension}",
"path-remove": "\u0000-\u001f\u007f\u0080-\uDBFF\uDFFF",
"directory": ["{category}"],
"content": true,
"twitpic": false,
"videos": true
},
"instagram": {
"username": "user",
"password": "thiswouldbethepassword",
"filename": "{username} - {description[0:200]}.{extension}",
"path-remove": "\u0000-\u001f\u007f\u0080-\uDBFF\uDFFF",
"directory": ["{category}"],
"content": true,
"twitpic": false,
"videos": true
}
},
"downloader": {
"ytdl": {
"format": null,
"forward-cookies": true,
"mtime": true,
"outtmpl": null,
"rate": null,
"retries": 4,
"timeout": 30,
"verify": true
}
},
"output": {
"mode": "auto",
"progress": true,
"shorten": true,
"log": "[{name}][{levelname}] {message}",
"logfile": null,
"unsupportedfile": null
}
}
````
Instagram made a slight change to its login process. Instead of sending the password as plaintext, they now encrypt it beforehand (even though this all gets sent over an already encrypted HTTPS connection.) It now looks something like #PWD_INSTAGRAM_BROWSER:10:<timestamp>:<base64 encoded encrypted password>
The details of how the password gets encrypted are most likely buried somewhere in https://www.instagram.com/static/bundles/es6/ConsumerLibCommons.js/ec7c3efd6675.js, but I haven't been able to figure this out yet.
For the time being, you should set your username to an empty string and use the Instagram cookies from your browser. You can get your sessionid cookie from the dev console (F12) and put that into your config file (*), or you export them with a "cookies.txt" browser addon and load them that way.
(*)
"instagram": {
"cookies": {
"sessionid": "your value here"
}
}
Yes, got to download saved posts of my own account. This is pretty much solved, until Instagram decides to change something up (again). Thanks mikf.
Most helpful comment
Instagram made a slight change to its login process. Instead of sending the password as plaintext, they now encrypt it beforehand (even though this all gets sent over an already encrypted HTTPS connection.) It now looks something like
#PWD_INSTAGRAM_BROWSER:10:<timestamp>:<base64 encoded encrypted password>The details of how the password gets encrypted are most likely buried somewhere in https://www.instagram.com/static/bundles/es6/ConsumerLibCommons.js/ec7c3efd6675.js, but I haven't been able to figure this out yet.
For the time being, you should set your
usernameto an empty string and use the Instagram cookies from your browser. You can get yoursessionidcookie from the dev console (F12) and put that into your config file (*), or you export them with a "cookies.txt" browser addon and load them that way.(*)