Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instagram login error [http 400 Bad Request] #756

Closed
lihuelworks opened this issue May 15, 2020 · 2 comments
Closed

Instagram login error [http 400 Bad Request] #756

lihuelworks opened this issue May 15, 2020 · 2 comments

Comments

@lihuelworks
Copy link

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
  }
}
@mikf
Copy link
Owner

mikf commented May 16, 2020

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"
    }
}

@mikf mikf changed the title Instagram logging/downloading error [htttp 400 Bad Request] Instagram login error [http 400 Bad Request] May 16, 2020
@lihuelworks
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants