Menu

#87 [Feature] Checking stories

closed
nobody
2025-11-23
2025-06-28
Anonymous
No

Originally created by: Quimisagi
Originally owned by: supreme-gg-gg

Is your feature request related to a problem? Please describe.
Similar to [#83], it would be also nice to be able to check stories from the CLI.

Describe the solution you'd like
I'm not sure, but I believe that Instagram MQTT already allows you to get stories.
Same as the feed, for the current scope I think its ok not playing videos, but only images.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Related

Tickets: #153
Tickets: #179
Tickets: #83

Discussion

  • Anonymous

    Anonymous - 2025-06-28

    Originally posted by: supreme-gg-gg

    Would probably benefit from first creating a generic UI media display interface (on top of Ink Image), then add a few backend client methods to fetch the media (whether post or story) and just pass it to the components, keeps it more modular and easier to build

     
  • Anonymous

    Anonymous - 2025-11-17
     
  • Anonymous

    Anonymous - 2025-11-18

    Originally posted by: supreme-gg-gg

    This is currently done with getting "reels tray" and then fetching each user story independently. I will make a few remarks on this issue in case we want to come back to it in the future:

    1. Alternative means to use our own "recommendations"

    Probably not a good idea, but at first I was doing this:

    if (mode === StoryFeedMode.Following) {
        // Get users the current user is following
        const followingFeed = ig.feed.accountFollowing(ig.state.cookieUserId);
        const followingUsers = await followingFeed.items();
    
        // Randomly select a subset (e.g., 10-20 users)
        const shuffledUsers = followingUsers.sort(() => 0.5 - Math.random());
        const selectedUsers = shuffledUsers.slice(
            0,
            Math.min(shuffledUsers.length, 20),
        );
    
        userIdsToFetch = selectedUsers.map(user => user.pk);
    } else if (mode === StoryFeedMode.RecentChats) {
        // Do not use cached inbox feed here to ensure we get latest threads
        const inboxFeed = ig.feed.directInbox();
        const threads = await inboxFeed.items();
        const uniqueUserPks = new Set<string>();
        for (const thread of threads) {
            if (thread.users) {
                for (const user of thread.users) {
                    if (user.pk.toString() !== this.ig.state.cookieUserId) {
                        uniqueUserPks.add(user.pk.toString());
                    }
                }
            }
        }
        userIdsToFetch = [...uniqueUserPks];
    } else if (mode === StoryFeedMode.User) {
        if (!username) {
            throw new Error('Username is required for user story mode');
        }
        const userId = await ig.user.getIdByUsername(username);
        userIdsToFetch = [userId];
    }
    
    let allStoryItems: UserStoryFeedResponseItemsItem[] = [];
    // alternatively:
    // const userStoryFeed = ig.feed.reelsMedia({userIds: [userId]});
    for (const userId of userIdsToFetch) {
        try {
            const userStoryFeed = ig.feed.userStory(userId);
            const items = await userStoryFeed.items();
            allStoryItems.push(...items);
        } catch (error) {
            // Log error but continue fetching for other users
            this.logger.warn(
                `Failed to fetch stories for user ${userId}: ${error instanceof Error ? error.message : String(error)}`,
            );
        }
    }
    

    I would prefer sticking with Meta's list for now, but just to put it on record that literally any method for filtering stories would work and we dont necessarily need to rely on that Meta endpoint.

    1. The difference between reelsMedia and userStory endpoints

    I am referring to:

    // This is recommended on the example
    const reelsMedia = await ig.feed.reelsMedia({userIds: userIdArray}).items();
    
    // This is what I use
    const userStory = await ig.feed.userStory(userId).items();
    

    I tested both endpoints with a script and the returned objects are pretty much identical. I cannot find a reason for why there exists two basically duplicate endpoints, but I decided to go with userStory in the end and it works fine for now. This is because of how I designed the generator using single userId just makes more sense for now, but perhaps there is a speed difference when batched. Again, just documenting here in case it bugs in the future, these are the only difference in terms of schema:

    ❯ diff data/userStory.json data/reelsMedia.json
    22,23d21
    <       "user",
    <       "subscribe_cta_visible",
    85a84
    >       "user",
    
     
  • Anonymous

    Anonymous - 2025-11-23

    Ticket changed by: supreme-gg-gg

    • status: open --> closed
     

Log in to post a comment.

Monday.com Logo