Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

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.

📸 Fetch Post Info

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);

👤 Fetch Profile Info

var pd = PublicAPIs.getProfileInfo("therock");
System.out.println(pd.username + " (" + pd.pk + ") - " + pd.name);
System.out.println("bio: " + pd.biography);

📂 Fetch Public Posts

// pk = numeric user id
var posts = PublicAPIs.getPosts("123456789", 6, null);
posts.forEach(p -> System.out.println(p.id + " — " + p.caption));

🏷️ Hashtag Search

var hp = PublicAPIs.hashtagSearch("cats", null);
while (hp.hasNext()) {
    var page = hp.next();
    page.forEach(item -> System.out.println(item.toString()));
}

💡 Tips

  • 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 numeric pk).
  • hashtagSearch → iterate results with HashtagPaginator.

✨ With these helpers, you can quickly explore posts, profiles, and hashtags without needing to log in!

Clone this wiki locally