use of me.postaddict.instagram.scraper.model.ActionResponse in project instagram-java-scraper by postaddictme.
the class Instagram method addMediaComment.
public ActionResponse<Comment> addMediaComment(String code, String commentText) throws IOException {
String url = Endpoint.addMediaCommentLink(MediaUtil.getIdFromCode(code));
FormBody formBody = new FormBody.Builder().add("comment_text", commentText).build();
Request request = new Request.Builder().url(url).header(Endpoint.REFERER, Endpoint.getMediaPageLinkByCode(code) + "/").post(formBody).build();
Response response = executeHttpRequest(withCsrfToken(request));
try (InputStream jsonStream = response.body().byteStream()) {
return mapper.mapMediaCommentResponse(jsonStream);
}
}
Aggregations