-
Notifications
You must be signed in to change notification settings - Fork 8
Posts
Rahil edited this page Apr 14, 2026
·
1 revision
This guide shows how to work with posts using JxInsta’s mobile API (com.jxinsta.mobile.endpoints.post).
You’ll learn how to fetch posts, like/unlike, comment, and explore likers & comments.
JxInsta insta = JxInsta.getInstance(AUTH_TOKEN);InstagramException (sometimes IOException). Always handle errors.
var post = insta.getPost("https://www.instagram.com/p/SHORTCODE/");
System.out.println("id: " + post.id + " caption: " + post.caption);var info = Post.getPost("https://www.instagram.com/p/SHORTCODE/");
System.out.println("shortcode: " + info.shortcode + " likes: " + info.likes);post.like(); // like the post
post.dislike(); // unlike the postvar likers = post.likers();
likers.forEach(System.out::println);post.comment("Nice photo!");
var paginator = post.getComments();
while (paginator.hasNext()) {
var page = paginator.next();
page.forEach(c -> System.out.println(c.username + ": " + c.text));
}var profile = insta.getProfile("some_user");
var pp = profile.getPosts();
while (pp.hasNext()) {
var page = pp.next();
page.forEach(p -> System.out.println(p.id + " — " + p.caption));
}- Use
insta.getPost(url)for authenticated posts (like/comment). - Use
Post.getPost(url)for public read-only info. - Paginators (
PostPaginator,CommentPaginator) work like iterators (hasNext(),next()). - Respect Instagram’s limits when liking or commenting repeatedly.
-
Post → actions like
like(),dislike(),comment(),getComments(). - PostData → read-only metadata (id, caption, likes, comments, media type).
- Comment → parsed comment object (id, username, text, createdAt, etc.).
- CommentPaginator → scroll through comments page by page.
- PostPaginator → scroll through a user’s posts.
✨ With these basics, you can fetch posts, interact with them, and explore comments with ease!