Instagram Post Scraper avatar
Instagram Post Scraper

Pricing

from $1.60 / 1,000 posts

Go to Store
Instagram Post Scraper

Instagram Post Scraper

Developed by

Apify

Apify

Maintained by Apify

Scrape Instagram posts. Just add one or more Instagram usernames and get your data in seconds including text, hashtags, mentions, comments, images, URLs, likes, locations, and metadata. Export scraped data, run the scraper via API, schedule and monitor runs or integrate with other tools.

4.5 (32)

Pricing

from $1.60 / 1,000 posts

435

Total users

41K

Monthly users

5.6K

Runs succeeded

>99%

Issues response

2.6 days

Last modified

2 days ago

DE

CDN images expire

Closed

developprotege opened this issue
a month ago

When using Apify’s Instagram scraper, the media URLs generated for downloaded content expire almost immediately, causing download failures.

Is there a way to access a stable URL for the copy of each media file that Apify has already downloaded, rather than relying on the original, short-lived Instagram URL?

alexey avatar

Hi!

This actor is not capable of downloading media files. URLs from Instagram expire in hours, normally in 24-48 hours. It is usually long enough for downloading, but it should be done as soon as possible after the run.

If you were blocked earlier, it means your IP is rejected or recognized as a data center.

To be sure, please try https://apify.com/lukaskrivka/images-download-upload with the input sample below (just change dataset ID):

{
"convertWebpToPng": false,
"datasetId": "cenIPyerkqY7FAiY2",
"fileNameFunction": "({ url }) => new URL(url).href.split('&').at(-1)",
"imageCheckType": "content-type",
"noDownloadRun": false,
"pathToImageUrls": "images",
"preDownloadFunction": "({ data }) => data.flatMap((postOrProfile) => {\r\n const items = postOrProfile?.latestPosts || [postOrProfile];\r\n return items.map((item) => {\r\n if (!item.images?.length) {\r\n item.images = [item.displayUrl];\r\n }\r\n item.images = item.images.filter(Boolean).map((url, index) => `${url}&${item.ownerUsername}-${item.shortCode}-${index}`)\r\n return item;\r\n })\r\n})",
"proxyConfiguration": {
"useApifyProxy": true
},
"s3CheckIfAlreadyThere": false,
"uploadTo": "key-value-store"
}
alexey avatar

I will close the issue now, but if there is anything else we can help with, please let us know.