Instagram-private-api: How to get the USER-STORY for the user

Created on 4 Apr 2017  路  3Comments  路  Source: dilame/instagram-private-api

Hello Guys,
i have pulled the repo to the npm install and its installed successfully.

When i tried to get UserStory feeds its returning empty array. I have tried the below code. Anyone can help me out on this. But, when i tried with PHP api its working.

var userStory = new Client.Feed.UserStory(session, 123456);
userStory.get().then(media => {
console.log(media);
});

Most helpful comment

First off, don't pass it an integer, but an array, so that would be new Client.Feed.UserStory(session, [123456]); if you only want one.

There seems to currently be a bug. The feed tries to return data.items but that is no longer correct, as instagram passes you data.reels and data.reels_media. Have a look at user-story.js. A quick and dirty fix is changing line 24 and onward to something like:

.then(function (data) {
    if (!data.reels_media.length) return [];
    var media = _.map(data.reels_media[0].items, function (medium) {
        return new Media(that.session, medium);
    });
    return media;    
});

Disclaimer: It's a quick and dirty fix, for only one user, no guarantees. If I can find some free time I'll do a proper fix and submit a pull request.

All 3 comments

First off, don't pass it an integer, but an array, so that would be new Client.Feed.UserStory(session, [123456]); if you only want one.

There seems to currently be a bug. The feed tries to return data.items but that is no longer correct, as instagram passes you data.reels and data.reels_media. Have a look at user-story.js. A quick and dirty fix is changing line 24 and onward to something like:

.then(function (data) {
    if (!data.reels_media.length) return [];
    var media = _.map(data.reels_media[0].items, function (medium) {
        return new Media(that.session, medium);
    });
    return media;    
});

Disclaimer: It's a quick and dirty fix, for only one user, no guarantees. If I can find some free time I'll do a proper fix and submit a pull request.

Hi Ziao,

Thank you very much i found the integer to array trick. Also found the error on user-story.js i have did the same quick fix like you.

If you found the proper fix please update me as well as.

Thank you

Hi Ziao,

It's been a very useful comment!

The same bug exists in Client.Feed.StoryTray
Here we should read data.tray

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LouenLeoncoeur picture LouenLeoncoeur  路  12Comments

prichey picture prichey  路  10Comments

dhillon2325 picture dhillon2325  路  14Comments

350d picture 350d  路  53Comments

zalkanorr picture zalkanorr  路  12Comments