PostData is a read-only value object populated from the API response. Post extends it with authenticated methods for liking, commenting, and enumerating users who liked the post.
Package
PostData
PostData is the base data class for Instagram media. It is returned directly by PublicAPIs.getPosts and PublicAPIs.getPostInfo, and acts as the superclass of Post.
Fields
The unique numeric media ID (Instagram’s internal primary key for the post).
The short alphanumeric code that appears in the post URL, e.g.
ABC123 in instagram.com/p/ABC123/.The caption text of the post. May be
null if the post has no caption.The type of media content. One of
IMAGE, VIDEO, or CAROUSEL.Array of direct media URLs. For
IMAGE and VIDEO posts the array contains a single entry. For CAROUSEL posts each index corresponds to one slide, in order.The number of likes the post has received.
The total number of comments on the post.
Post.MEDIA_TYPE enum
| Constant | Description |
|---|---|
IMAGE | A single static image. |
VIDEO | A single video clip. |
CAROUSEL | A multi-item slideshow of images or videos. |
Post
Post extends PostData and is returned by JxInsta.getPost. It carries a live session internally and exposes methods that perform actions against the post on Instagram.
like()
Likes the post on behalf of the authenticated user.
void
Throws — InstagramException
dislike()
Removes the authenticated user’s like from the post (equivalent to “unliking”).
void
Throws — InstagramException
likers()
Fetches the usernames of all accounts that have liked the post.
List<String> of usernames.
Throws — InstagramException
getComments()
Returns a CommentPaginator for the post’s comments. Call next() repeatedly until hasNext() returns false.
com.jxinsta.web.paginators.CommentPaginator
comment(String comment)
Posts a text comment on this post as the authenticated user.
The text content of the comment to post.
void
Throws — InstagramException