Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Download posts

Download a post

downloader https://youtu.be/dQw4w9WgXcQ -o videos

downloader <url> resolves the post and saves each media item into the directory given by -o, or the current directory. A file that already exists is skipped. A post the history records with its files still in that directory is skipped before any request; another directory gets a copy. A download is written to <name>.part and renamed when complete. A failed download keeps its .part, and the next run asks the server for the rest; a server that cannot send a range sends the whole file again. When the media host refuses an expired URL, the post is resolved once more. A download fails when the server sends nothing for 30 seconds.

Download several posts

downloader https://www.instagram.com/p/Df147tCiAyB/ https://youtu.be/dQw4w9WgXcQ
downloader - < urls.txt

Each URL is downloaded in turn. - reads URLs from stdin, one per line, and skips blank lines and lines that start with #. The first download starts before stdin ends.

A post that fails to resolve or download is reported, and the rest still download; the command then exits 1. A block, a rate limit or a refused session stops the run, since every later post would fail the same way.

Pick posts from an account

downloader @natgeo
downloader https://www.instagram.com/natgeo/
downloader https://www.facebook.com/natgeo

@user and an Instagram profile URL list an Instagram account. A Facebook page or profile URL lists that account: facebook.com/<name>, a tab such as /<name>/videos, /profile.php?id=<id> or /people/<name>/<id>. A post, photo or video URL downloads that post instead. Facebook lists only posts with a photo or video of their own; shares and text posts are left out.

In a terminal this opens a checkbox list of the newest posts. “Load more posts…” fetches the next page and keeps what is already checked. Only the checked posts are resolved and downloaded.

Without a terminal, or with --json, choose the posts with a flag:

FlagDownloads
--allEvery post.
--limit <n>The newest n posts.
--pick <list>Posts by number, as --list prints them: 1,3,5-8.
--listNothing. Prints the newest posts with their numbers and exits.

The command fails with a usage error when none of them is given and no picker can open.

--type and --author narrow the listing before any of these apply, so --list numbers, --pick and --limit count only matching posts. --type takes photo, video or album; an album holding a video is still an album. --author takes account names, with or without @. Both take a comma list. A filter that matches rarely reads many pages before the first post shows.

downloader https://www.instagram.com/<you>/saved/ --all --type video
downloader https://www.instagram.com/<you>/saved/ --list --author natgeo,nasa

--all and --limit download each page of posts as it arrives, so the first files land before the account is fully listed. A failed post is handled as in Download several posts.

Download your saved posts

downloader https://www.instagram.com/<you>/saved/all-posts/ --all -o saved

instagram.com/<you>/saved/ and its all-posts tab list the posts the account saved, newest save first, with the same picker and flags as an account. Only the account itself can see them, so this target uses the saved session from the first request and fails with not_logged_in without one; see Log in. A URL that names a different account than the session fails with login_required. The saved feed already holds each post’s media, so a saved post downloads without a second request.

downloader https://www.instagram.com/<you>/saved/<name>/<id>/ --all -o trips

A named collection lists only its posts. Open the collection on the Saved page in the browser and copy its URL: the URL ends in the collection’s ID.

Keep post metadata

downloader @natgeo --limit 5 --metadata -o natgeo

--metadata appends one JSON line per downloaded post to posts.jsonl in the output directory. A line holds url, author, platform, description (the caption), timestamp in Unix seconds, the counts the platform returned (likes, comments, views, shares, reposts), files and saved_at. Counts change over time, and saved_at dates them. A post already in the download history is skipped and writes no line. get and account listings take the flag.