Instagram scraper
Runs the Intropix Instagram scrapers on Apify and saves what they return. One
skill for any Instagram job; it picks the right scraper, runs it, and saves
the files.
Rules
- Public business, creator and brand accounts only. If the user asks for a
private person's account, say the scrapers' terms do not allow it and stop.
Private accounts are never readable.
- Tagged accounts, mentions and partners in the results can be private people:
do not scrape them in turn or build profiles of them.
- Keep the results only as long as the user's purpose needs them (the terms
suggest at most 30 days), and do not republish them as a dataset.
1. Pick the scraper
| The user wants | Scraper | Price |
|---|
| Stories that are live now (they vanish after 24 hours) | intropix/instagram-stories-scraper
| $2.50 per 1,000 stories |
| Posts, reels, carousels with captions, likes, comments, views, dates | intropix/instagram-posts-reels-scraper
| $1.90 per 1,000 posts |
| Also music, shares, location, sponsor brand names, partner sizes, the account's public email, phone, address and website | intropix/instagram-posts-reels-scraper-pro
| $3.90 per 1,000 posts |
Use the cheapest scraper that has the fields the user needs. Every run also
costs $0.005, plus $0.002 per account scanned; failed lookups are not charged.
If one of these skills is installed and fits the job better, use it instead:
,
,
,
download-competitor-instagram
,
track-instagram-brand-deals
,
get-instagram-business-contacts
.
2. Build the input
Stories:
json
{"usernames": ["natgeo"], "maxResults": 10}
is the most story items to deliver (default 10).
Posts and reels (standard and PRO take the same input):
json
{"usernames": ["nike"], "maxPosts": 10}
| Field | Use |
|---|
| Account handles without . |
| Instead of or besides usernames: links like https://www.instagram.com/p/<code>/
or . Every valid link is delivered. |
| How many of the newest posts to read. Default 10. One shared total for the whole run. |
| Instead of : up to this many of EACH account's newest posts. Use it whenever there are several accounts. |
| , | Optional (UTC) bounds. |
| (default), or . With a filter, counts posts read, not posts delivered, and every match among them is delivered and billed: for N reels set to about 1.5 times N (2 for one reel), and save everything delivered. |
| also returns reels shown only on the reels tab. |
| PRO only: adds follower count, category and verification for each co-author and sponsor brand ($0.005 per profile, paid Apify plans only). |
For the public contact details of accounts, run PRO with
; the
fields of each post carry them.
Several accounts: for posts, use
;
alone
is one shared total spent in input order, so the first account can use it
all. A run holds at most 1,000 posts on a paid plan (10 on the free plan),
filled account by account. The stories scraper has no per-account limit: for
stories, start one run per account.
Ask how many items if the user did not say; otherwise use 10. A free Apify
plan delivers at most 10 results per run and 40 per day.
3. Run the scraper
Use the first path that is available.
A. Apify tools are connected (tools named
and
, from the Apify connector or
):
call
with the scraper id and the input. If the run is not
finished when the call returns, poll
until it is. Then read
the results with
using the run's dataset id, and set
to the run's item count (the default is 20). With a shell, write the
returned items, as one JSON array, to
for step 4.
B. A shell with the Apify CLI (
prints 1.5 or later):
write the input to
, then run
bash
apify actors call <scraper id> --input-file input.json --json 2>/dev/null
Take
and
storage.defaultKeyValueStoreId
from the
printed JSON (do not add
: together with
it prints nothing).
Then save the results:
bash
apify datasets get-items <defaultDatasetId> --format json > items.json
If the CLI says you are not logged in, ask the user to run
themselves (it opens a browser). Never ask the user to paste an API token into
the conversation.
C. Neither is available: tell the user to either connect Apify
(
) or install the CLI (
, then
). An Apify account is free to create. Stop there.
4. Save the files
Skip this step when the user wants data only. Media links point at
Instagram's CDN and expire within days, so download right after the run.
With a shell and Python 3:
bash
python3 ${CLAUDE_SKILL_DIR}/scripts/save_media.py items.json instagram --covers
(
is this skill's folder; use its real path if the variable
is not set.) This writes
instagram/<username>/<date>_<id>[_<slide>].jpg|mp4
,
reel covers beside the videos, and appends each item once to
instagram/<username>/items.jsonl
, so repeated runs only add what is new.
Without Python, download each
(stories) or
(posts) with
. Without a shell, show the links and say they expire.
For a spreadsheet, write a CSV from
with the columns the user
asked for.
5. Report
Say what was saved and where, then answer the user's question from the data.
Null means "not available", never zero.
Fewer results than expected or none: stories return nothing when the
account posted none in the last 24 hours. Otherwise read the run's
record (
apify key-value-stores get-value <defaultKeyValueStoreId> OUTPUT
, or
get-key-value-store-record
with key
):
(wrong handle),
(free plan daily limit reached),
or
(retry later).
Scraper pages: