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.

No credit card required

Author's avatarJaroslav Hejlek
  • Modified
  • Users7,497
  • Runs2,123,143

Add Instagram URLs you want to scrape

directUrls

Optional

array

Add one or more Instagram URLs to scrape. Tip: Location URLs will only scroll if you use an Instagram login.

What do you want to scrape from each page?

resultsType

Optional

string

Decide what you want to scrape from each Instagram page URL or search result. Tip: You need to select the correct parent page based on URL, e.g. comments can only be scraped from posts, not from profiles.

Options:

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

Max items

resultsLimit

Optional

integer

How many posts or comments you want to scrape from each Instagram URL or found page. If you set this to 1, you will get a single post from each page. This is ignored when "Details" type is specified. Note that, if you search via hashtags or place, each found page will have this limit applied separately.

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 (e.g. hashtags, profiles, or pages) should be processed. If you set this to 1, you will just scrape a single search term. If you set it to 3, you will scrape three search terms, and so on.

Scrape until date

scrapePostsUntilDate

Optional

string

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

Scrape from date

fromDate

Optional

string

Scrapes post and comments from the current date until it reaches a post older than the provided date. The date should be in YYYY-MM-DD format or relative time, e.g. yesterday. By default it scrapes all posts.

Scrape until date

untilDate

Optional

string

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

Proxy configuration

proxy

Required

object

A proxy server is required to run this actor! Either use an Apify residential proxy, or provide your own proxy servers. Datacenter proxies will not work.

Max request retries

maxRequestRetries

Optional

integer

Select how many times the page will be retried if the scraper is blocked or encounters other errors.

Scroll wait seconds

scrollWaitSecs

Optional

integer

Select how many seconds the scraper will wait between every 100 posts/comments when scrolling. If you scrape more than 1,000 items, it is important to slow down so that the scraper is not blocked. The seconds are randomized slightly. If the scraper gets blocked, try increasing this number.

Cookies

loginCookies

Optional

array

If you want to sign in to Instagram so that you will have access to more data than with an anonymous profile, but do not wish to save 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 Instagram account. Note that you will need to enter the authorization code that will be sent to the email address associated with the Instagram account.

Login Password

loginPassword

Optional

string

Password for Instagram account. Note that you will need to enter the authorization code that will be sent to the email address associated with the Instagram account.

Get post likes

likedByLimit

Optional

integer

If this limit is set above 0, then the scraper 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 scraper will attempt to find users followed by the profile owner.

Get profile followed by

followedByLimit

Optional

integer

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

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 scraper will attempt to query additional details about the post 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.

Debug Log

debugLog

Optional

boolean

Enable a more verbose logging to be able to understand what's happening during the scraping.

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.

Include Tagged posts

includeTaggedPosts

Optional

boolean

Get the tagged posts for each profile