Actor picture

Instagram Scraper

jaroslavhejlek/instagram-scraper

Scrape and download Instagram posts, profiles, places, hashtags, photos, and comments. Supports search queries and URL lists. Download your data as HTML table, JSON, CSV, Excel, XML, and RSS feed.

Author's avatarJaroslav Hejlek
  • Modified
  • Used by6,793 users
  • Used1,699,337 times
Actor picture
Instagram Scraper

Search type

searchType

Optional

string

What type of pages to search (you can search hashtags, profiles and places)

Options:

"user", "hashtag", "place", "stories"

Search results limit

searchLimit

Optional

integer

How many search results (eq. pages) should be processed.

Direct Instagram page URLs

directUrls

Optional

array

If you already have URL(s) of page(s) you wish to scrape, you can set them here. This field is optional, but this field or 'Search' must be provided. Location URLs scroll only with login.

What to scrape from each page.

resultsType

Optional

string

What to scrape from each Instagram page URL or search result. You need to provide correct parent pages, e.g. comments can be scraped only from posts, not from profiles.

Options:

"posts", "comments", "details", "stories", "cookies"

Max items

resultsLimit

Optional

integer

How many posts or comments to scrape from each Instagram URL or found page, ignored when "Details" type is specified. Notice that if you use search via hashtags or place, each found page will have this limit separately. You can limit searchLimit to reduce the number of total results.

Max request retries

maxRequestRetries

Optional

integer

How many times a page will be retried in case of being blocked or other errors.

Scrape posts until date

scrapePostsUntilDate

Optional

string

Scrapes post from the current date until it reaches a post older than a provided date. The date should be in format YYYY-MM-DD. By default scrapes all posts.

Scroll wait seconds

scrollWaitSecs

Optional

integer

How many seconds it will wait every 100 posts/comments when scrolling. If you scrape more than 1000 items, it is important to slow down to not get blocked. The seconds are randomized a bit. If you get blocked anyway, try to increase this number.

Proxy configuration

proxy

Required

object

Proxy is required to run this actor! Either use Apify RESIDENTIAL proxy, or provide your own proxy servers. Non-RESIDENTIAL proxy groups usually don't work.

Cookies

loginCookies

Optional

array

If you want to sign in to Instagram to have access to more data than on anonymous profile, but do not wish to have your credentials in input, then you can use your cookies.

Max error count cookies

maxErrorCount

Optional

integer

Setting this number too high might get your account blocked faster

Concurrency

cookiesPerConcurrency

Optional

integer

Set number of cookies that are used per one concurrent browser. (e.g. if set to 3 and set 6 sets of loginCookies, then it will run with concurrency 2 so each browser can choose randomly from three sets of cookies.)

Login Username

loginUsername

Optional

string

Login for IG account. You will have to fill in code, that you receive to email connected to IG account.

Login Password

loginPassword

Optional

string

Password for IG account. You will have to fill in code, that you receive to email connected to IG account.

Get post likes

likedByLimit

Optional

integer

If this limit is set above 0, then the solution will attempt to load additional details about users who liked the post.

Get profile following

followingLimit

Optional

integer

If this limit is set above 0, then the solution will attempt to find users who the profile owner is following.

Get profile followed by

followedByLimit

Optional

integer

If this limit is set above 0, then the solution will attempt to find users who the profile owner is followed by.

Extend Output Function

extendOutputFunction

Optional

string

Add or remove properties on the output object or omit the output returning null

Extend Scraper Function

extendScraperFunction

Optional

string

Advanced function that allows you to extend the default scraper functionality, allowing you to manually perform actions on the page

Custom data

customData

Optional

object

Any data that you want to have available inside the Extend Output/Scraper Function

Query post owner

expandOwners

Optional

boolean

If this feature is used, then for each post the solution will attempt to query additional details about it's owner. This will drastically slow down the crawling speed and increase the chance of an account ban if credentials are provided.

Max Concurrency

maxConcurrency

Optional

integer

Max number of allowed instances running in parallel. More instances need more memory!

Use stealth

useStealth

Optional

boolean

Enable stealth in case of increased blocking

Include Has Stories

includeHasStories

Optional

boolean

If this feature is used, then for each user detail property has_public_story from xhr request is parsed.