Skip to content

Add InstagrAPI script #281

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

Merged
merged 7 commits into from
Mar 28, 2025
Merged

Add InstagrAPI script #281

merged 7 commits into from
Mar 28, 2025

Conversation

erinhmclark
Copy link
Collaborator

@erinhmclark erinhmclark commented Mar 28, 2025

Add scripts for running a local fastAPI server, or docker instance of InstagrAPI which can be used for the Instagram API Extractor.
Previously it was expected to use the paid service https://api.instagrapi.com/docs.
These scrips use the same naming of endpoints, but only defining the paths currently used by the Auto Archiver Instagram API Extractor.

The setup process required currently involves a few steps (run server locally once to create settings file, this requires installing the requirements etc) as the first time authentication was being rejected when running in Docker.
There might be additional settings we could pass to the script which would allow verification in Docker which would simplify the process and allow the container to be setup an run with a single script, (tried with adding device and user agent, but still rejected.)


The server should now be running within that session, and accessible at http://127.0.0.1:8000

You can set this in the orchestration.yaml file like this:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth saying "in the Auto Archiver orchestration.yaml file..."?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this empty file needed? Perhaps it needs the secrets folder, or that might already be covered by the root gitignore

@pjrobertson
Copy link
Collaborator

Nice! Looks good to me. Only a few minor comments :)

@pjrobertson
Copy link
Collaborator

Tests are failing here now - not sure why, could be because the poetry.lock file changed. Does that need to change?

Requires setting up an Instagrapi API deployment and providing an access token and API endpoint.
Requires either getting a token from using a hosted [(paid) service](https://api.instagrapi.com/docs) and setting this in the configuration file.
Alternatively you can run your own server. We have a basic script which you can use for this which can be ran locally or using Docker.
For more information, read the [how to guide](https://auto-archiver.readthedocs.io/en/latest/how_to/run_instagrapi_server.html) on this.
Copy link
Collaborator

@pjrobertson pjrobertson Mar 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally this shouldn't be hard-coded to the latest version. Should use:

[how to guide](../../../how_to/run_instagrapi_server.md) ( I think I got the reference right!)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For more information, read the [how to guide](https://auto-archiver.readthedocs.io/en/latest/how_to/run_instagrapi_server.html) on this.
For more information, read the [how to guide](../../../how_to/run_instagrapi_server.md) on this.

@pjrobertson
Copy link
Collaborator

Just followed the guide and set everything up – it all works! Will approve once the tests are fixed :)

@erinhmclark
Copy link
Collaborator Author

Just followed the guide and set everything up – it all works! Will approve once the tests are fixed :)

That's great to hear! I'm slightly devastated that I couldn't get it to authenticate directly in Docker, but at least this is an option 😂

@pjrobertson
Copy link
Collaborator

Just followed the guide and set everything up – it all works! Will approve once the tests are fixed :)

That's great to hear! I'm slightly devastated that I couldn't get it to authenticate directly in Docker, but at least this is an option 😂

I just debugged this, and I think it's because you're putting quotes around the username/password in the .env file. If I remove those, it works for me. More info: docker/compose#3702 (comment)

@erinhmclark
Copy link
Collaborator Author

Just followed the guide and set everything up – it all works! Will approve once the tests are fixed :)

That's great to hear! I'm slightly devastated that I couldn't get it to authenticate directly in Docker, but at least this is an option 😂

I just debugged this, and I think it's because you're putting quotes around the username/password in the .env file. If I remove those, it works for me. More info: docker/compose#3702 (comment)

Ohh that actually works! I have a script in that case, and will just update the docs to match.
That makes it so much easier to set up :)

# run_instagrapi_server.sh
# Usage:
# From repo root: ./scripts/instagrapi_server/run_instagrapi_server.sh
# From repo root: ./scripts/instagrapi_server/run_instagrapi_server.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate line

Copy link
Collaborator

@pjrobertson pjrobertson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved!

@erinhmclark erinhmclark merged commit 96efdcb into main Mar 28, 2025
7 checks passed
@erinhmclark erinhmclark deleted the add_inst_api_script branch March 31, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants