https://github.com/tatsh/instagram-archiver
Tool to download data from an Instagram profile you have access to.
https://github.com/tatsh/instagram-archiver
api instagram
Last synced: 2 months ago
JSON representation
Tool to download data from an Instagram profile you have access to.
- Host: GitHub
- URL: https://github.com/tatsh/instagram-archiver
- Owner: Tatsh
- License: mit
- Created: 2022-06-07T17:31:21.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-04-07T23:09:16.000Z (over 1 year ago)
- Last Synced: 2025-04-12T12:07:14.453Z (over 1 year ago)
- Topics: api, instagram
- Language: Python
- Homepage: https://instagram-archiver.rtfd.io/
- Size: 1.02 MB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
# instagram-archiver
[](https://www.python.org/)
[](https://pypi.org/project/instagram-archiver/)
[](https://github.com/Tatsh/instagram-archiver/tags)
[](https://github.com/Tatsh/instagram-archiver/blob/master/LICENSE.txt)
[](https://github.com/Tatsh/instagram-archiver/compare/v0.4.1...master)
[](https://github.com/Tatsh/instagram-archiver/actions/workflows/codeql.yml)
[](https://github.com/Tatsh/instagram-archiver/actions/workflows/qa.yml)
[](https://github.com/Tatsh/instagram-archiver/actions/workflows/tests.yml)
[](https://coveralls.io/github/Tatsh/instagram-archiver?branch=master)
[](https://github.com/dependabot)
[](https://instagram-archiver.readthedocs.org/?badge=latest)
[](https://mypy-lang.org/)
[](https://docs.astral.sh/uv/)
[](https://docs.pytest.org/en/stable/)
[](https://github.com/astral-sh/ruff)
[](https://pepy.tech/project/instagram-archiver)
[](https://github.com/Tatsh/instagram-archiver/stargazers)
[](https://github.com/pre-commit/pre-commit)
[](https://prettier.io/)
[](https://bsky.app/profile/Tatsh.bsky.social)
[](https://buymeacoffee.com/Tatsh)
[](irc://irc.libera.chat/Tatsh)
[](https://hostux.social/@Tatsh)
[](https://www.patreon.com/Tatsh2)
Save Instagram content you have access to.
## Installation
```shell
pip install instagram-archiver
```
## Usage
```plain
Usage: instagram-archiver [OPTIONS] [USERNAME]
Archive a profile (USERNAME) or your saved posts (--saved).
Pass exactly one of: a USERNAME positional argument, or --saved/-s.
Options:
-o, --output-dir DIRECTORY Output directory. Defaults to the username
(profile mode) or `.` (saved mode).
-b, --browser [brave|chrome|chromium|edge|opera|vivaldi|firefox|safari]
Browser to read cookies from.
-p, --profile TEXT Browser profile.
-d, --debug Enable debug output.
-q, --quiet Disable progress display updates.
-S, --sleep-time INTEGER Number of seconds yt-dlp waits between
requests.
--no-log Ignore log (re-fetch everything).
-C, --include-comments Also download all comments (extends download
time significantly).
-R, --include-child-comments Also recursively download child (reply)
comments. Implies --include-comments.
-s, --saved Archive your saved posts instead of a
profile (mutually exclusive with USERNAME).
-u, --unsave Unsave posts after successful archive (only
with --saved).
-h, --help Show this message and exit.
```
Typical use:
```shell
instagram-archiver -o ~/instagram-backups/username username
instagram-archiver --saved -o ~/instagram-backups/saved
```
When neither `--debug` nor `--quiet` is passed, a Rich-based live progress
display (provided by the `archiver-stats` library) is shown on stderr. Pass
`--quiet` to disable it for non-interactive use, or `--debug` to see verbose
log output instead.
Downloads run concurrently using `niquests.AsyncSession` and
producer/consumer queues: one worker for media posts, one for comments
(when `-C` is passed), and one for yt-dlp video downloads. Each worker
handles at most one in-flight HTTP request at a time, which keeps Instagram
rate-limiting at bay while still overlapping image downloads with yt-dlp.
The dedup log lives at `/.log.db` and is honoured across runs in
both profile and `--saved` modes. Pass `--no-log` to bypass it and re-fetch
everything.
## Notes
The default output path is the username under the current working directory.
Videos are saved using yt-dlp and its respective configuration.
In profile mode, both image and video items in the user's highlights and currently-active stories
are archived. Image story items go through the same media pipeline as posts, while video items
are handed to yt-dlp.