Skip to main content

Download images and videos from Instagram

Project description

BasketCase

Download images and videos from Instagram.

Notable features:

  • Stories can be downloaded without triggering the "seen" flag.
  • Downloads a high quality version of a profile picture.

Installation

Install it from PyPI.

pip install --user basketcase

This should put the executable basketcase on your PATH.

Command-line usage

basketcase -u "https://instagram.com/p/<post_id>"

Downloaded resources will be stored in the current working directory (i.e. $PWD/basketcase_downloads).

To download from multiple URLs, create a text file (e.g. urls.txt) and populate it with resource URLs:

https://instagram.com/p/<post_id>
https://instagram.com/reel/<reel_id>
https://instagram.com/<username>
basketcase -f ./urls.txt

Supported URLs

Supported URL Description
https://instagram.com/<username> User profile. Downloads stories from the past 24 hours, and the profile picture.
https://instagram.com/p/<post_id> Standard publication.
https://instagram.com/reel/<reel_id> Reels movie
https://www.instagram.com/stories/highlights/<highlight_id>/ A collection of stories, or "highlights"
https://www.instagram.com/s/<random_characters> A shorter type of URL

Authentication

  1. Add a session cookie
basketcase --cookie <session_cookie_id> --cookie-name "my session"
# Added session id: 1
  1. Specify its identifier when downloading
basketcase -s 1

List all available sessions with basketcase -l. To disable sessions, use --no-session. If only one exists, it is treated as the default.

User data

Cookies and other application data are kept in your home directory (i.e. ~/.basketcase).

Development setup

  1. cd to the project root and create a virtual environment in a directory named venv, which is conveniently ignored in version control.
  2. Install the dependencies.
pip install -r requirements.txt
  1. Install this package in editable mode.
pip install -e .

Package build and upload

  1. Update the requirements list.
pip freeze --exclude-editable > requirements.txt
  1. Increment the version on pyproject.toml.
  2. Build the package.
python -m build
  1. Commit and push the changes (and a new version tag) to the git repository.
  2. Publish it.
python -m twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

basketcase-5.0.0.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

basketcase-5.0.0-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file basketcase-5.0.0.tar.gz.

File metadata

  • Download URL: basketcase-5.0.0.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for basketcase-5.0.0.tar.gz
Algorithm Hash digest
SHA256 92a3e8f9839b92dd61f8c493bce5cdf52c6eadf0d785500b0fc983e52c9c1b5f
MD5 d654f0bff5e5a07291f9624c50f8161b
BLAKE2b-256 8921dd14e5800bfc56114ab1ed6fe73f241ba2aa264fd79c91b48704f20342f9

See more details on using hashes here.

File details

Details for the file basketcase-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: basketcase-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for basketcase-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49f7698db83e2169f2089582b919d4a3d1b3126ff728e130d09f947da6ed2adb
MD5 d166948c1983fdf0a40eca7ded8d3062
BLAKE2b-256 8062de6e0019edd949c0fc7ae9ea02dc42338ec1448bca3317f70c533911a0fa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page