Instagram Scraper avatar
Instagram Scraper
Try for free

No credit card required

View all Actors
Instagram Scraper

Instagram Scraper

apify/instagram-scraper
Try for free

No credit card required

Scrape and download Instagram posts, profiles, places, hashtags, photos, and comments. Get data from Instagram using one or more Instagram URLs or search queries. Export scraped data, run the scraper via API, schedule and monitor runs or integrate with other tools.

User avatar

Instagram assets expire after approximately 24 hours

Closed

mattblode opened this issue
11 days ago

When I do a scrape, I want to display the assets on the front-end of my mini website platform as a social feed. I'm proxying the images via a Cloudflare worker, however, I have found that the assets expire after approximately 24 hours. Is there a way to bypass this restriction with serving Instagram assets? The only options I have are to scrape every 24 hours or to scrape once per week (for example) and upload the assets to S3 and serve them from there. Does anyone have experience working around this issue?

User avatar

Hi! Its known anti-hotlinking protection applied by Meta all media URLs, they expire exactly to not allow reusing direct URLs by somebody else. You need to download media URLs ASAP and then host in your own CDN by another actor: https://apify.com/lukaskrivka/images-download-upload Please try sample input optimized for downloading IG results:

1{
2    "convertWebpToPng": false,
3    "datasetId": "kya3nQTKUtFYNVhrk",
4    "fileNameFunction": "({ url }) => new URL(url).pathname.split(\"/\").pop()",
5    "imageCheckType": "content-type",
6    "noDownloadRun": false,
7    "pathToImageUrls": "images",
8    "preDownloadFunction": "({ data }) => data.map((item) => {\r\n    if (!item.images?.length) {\r\n        item.images = [item.displayUrl];\r\n    }\r\n    return item;\r\n})",
9    "proxyConfiguration": {
10        "useApifyProxy": true
11    },
12    "s3CheckIfAlreadyThere": false,
13    "uploadTo": "zip-file"
14}

You can also ask community in Apify Discord #hire-freelancers to build a simple integration script for this.

I´m going to close the issue now, but if there would be anything else we could help with, please let us know.

Developer
Maintained by Apify
Actor metrics
  • 2.5k monthly users
  • 100.0% runs succeeded
  • 1.1 days response time
  • Created in Apr 2019
  • Modified 12 days ago