After a new Instagram update the feed.get() is not updating the results.
Yesterday it was working as usual.
I'm using it with MediaComments.
Promise.mapSeries(_.range(0, 20), function() {
return feed.get();
})
.then(comments => {
_.each(comments, comment => {
console.log(comment);
});
});
Now it's just repeating the same results over and over.
I tested UserMediaFeed and get method worked as should.
But I can confirm there really is a problem with MediaCommentsFeed. It's fetching the first 20 comments all over again.
const Client = require('instagram-private-api').V1;
(async () => {
let device = new Client.Device('marek.vybiral');
let storage = new Client.CookieFileStorage(__dirname + '../../********.json');
let session = await Client.Session.create(device, storage, '*********', '********');
let account = await Client.Account.searchForUser(session, '*********');
let accountMedia = new Client.Feed.UserMedia(session, account.id, 15);
let media = await accountMedia.get();
let post = media[0];
let postComments = new Client.Feed.MediaComments(session, post.id);
for (let i = 0; i <= 3; i++) {
let comments = await postComments.get();
comments.map((comment) => {
console.log(comment._params.id);
});
}
})();

It looks like, into constants.js at mediaComments the parameter max_id is ignored.
The results of :
mediaComments: 'media/<%= mediaId %>/comments/<%= maxId ? ("?max_id=" + maxId) : "" %>'
and :
mediaComments: 'media/<%= mediaId %>/comments/'
are the same.
Both repeating the first 20 comments.
Also I checked in media-comments.js if the maxId is getting the right value from the getCursor() and it seems to be fine.
I'm getting a problem as well, trying the following code with Request:
const mediaId = '********';
const maxId = '********';
let url = `${Client.CONSTANTS.API_ENDPOINT}media/${mediaId}/comments/`;
if (maxId) {
url += `?max_id=${maxId}`;
}
try {
const request = new Client.Request(session).setMethod('GET').setUrl(url);
const response = await request.send();
console.log(response.comments[0]);
console.log(response.next_max_id);
} catch (e) {
console.log('ERROR');
console.log(e);
}
Entering a value for max_id doesn't seem to make a difference here. I also tried a few different keys to see if it the parameter was renamed on instagram's side, but I haven't found anything yet.
Any update regarding this bug?
The pull Request submitted in #566 doesn't seem to solve the issue. Has Instagram changed the pagination parameter for this endpoint?
The pull Request submitted in #566 doesn't seem to solve the issue. Has Instagram changed the pagination parameter for this endpoint?
My PR just fix comments feed, I didn't fix other feeds. You can use SSL tool from comments in my PR and find right way for your case.
I meant for the comment feed. It still only provides 20 results in some cases. Instagram only returns next_min__id when the flag has_more_headload_comments is true. In other cases, if the flag has_more_comments is true, then the endpoint still sends next_max_id. The pull request code doesn't seem to solve all cases.
+1
Has anyone found a solution yet?
I have just found a fix. The new max_id value is no longer just the server_cursor field. Just use the value of next_max_id (which is a JSON string), then URL encode it and use that as max_id
The URL should then look something like that:
https://i.instagram.com/api/v1/media/.../comments/?max_id=%7B%22server_cursor%22%3A%20%22...%22%2C%20%22is_server_cursor_inverse%22%3A%20false%7D
I will open a PR for that
EDIT: Or I could just use the latest commit, why is this not closed if it is already fixed?
Most helpful comment
I'm getting a problem as well, trying the following code with Request:
Entering a value for
max_iddoesn't seem to make a difference here. I also tried a few different keys to see if it the parameter was renamed on instagram's side, but I haven't found anything yet.