This repository was archived by the owner on Apr 18, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Public APIs
Rahil edited this page Apr 14, 2026
·
2 revisions
The PublicAPIs helpers let you access Instagram data without logging in.
They’re read‑only and perfect for quick lookups, but remember: public endpoints can be rate‑limited.
var info = PublicAPIs.getPostInfo("https://www.instagram.com/p/SHORTCODE/");
System.out.println("id: " + info.id);
System.out.println("caption: " + info.caption);
System.out.println("likes: " + info.likes + " comments: " + info.comments);var pd = PublicAPIs.getProfileInfo("therock");
System.out.println(pd.username + " (" + pd.pk + ") - " + pd.name);
System.out.println("bio: " + pd.biography);// pk = numeric user id
var posts = PublicAPIs.getPosts("123456789", 6, null);
posts.forEach(p -> System.out.println(p.id + " — " + p.caption));var hp = PublicAPIs.hashtagSearch("cats", null);
while (hp.hasNext()) {
var page = hp.next();
page.forEach(item -> System.out.println(item.toString()));
}- Public endpoints are rate‑limited → cache results when possible.
-
getPostInfo→ read‑only post data. For actions (like/comment), use authenticated APIs. -
getProfileInfo→ basic profile info (username, bio, etc.). -
getPosts→ fetch a user’s public timeline (needs numericpk). -
hashtagSearch→ iterate results withHashtagPaginator.
✨ With these helpers, you can quickly explore posts, profiles, and hashtags without needing to log in!