DEV Community

梁小君
梁小君

Posted on Edited on

Fetching age-restricted Instagram reels by URL

I needed to resolve Instagram reel/post URLs to direct media links, including posts that Instagram only shows to logged-in adults ("This content isn't available to everyone"). I tested a few data APIs against the same set of real URLs. Notes from the experiment:

Public-data scrapers can't see age-restricted posts. Large scraping platforms that only collect publicly visible data returned errors like "The post is age-restricted" for every restricted URL in my set. That's expected — logged-out visitors can't see them either.

Login-backed APIs can. HikerAPI resolved 35 of 38 age/audience-restricted posts in my sample. A single call returns CDN links for the video and cover:

import requests
r = requests.get("https://api.hikerapi.com/v1/media/by/url",
                 params={"url": "https://www.instagram.com/reel/<code>/"},
                 headers={"x-access-key": "YOUR_KEY"})
print(r.json())
Enter fullscreen mode Exit fullscreen mode

Limitations I hit:

  • Private accounts: nothing comes back, which is how it should be.
  • Stories: stories under 24 hours old worked; older ones that live in highlights returned StoryNotFound by story URL.
  • Billing counts 4xx answers too (200/403/404 are billed, 5xx are not), so dedupe and cache before calling.
  • Default throughput is 15 requests/second per account.

If you only need public posts, almost any scraper works. For restricted content, check whether the provider is login-backed before comparing prices.

Top comments (0)