junhoyeo / threads-api

Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's Threads. Web UI Included.
https://threads.junho.io
MIT License
1.58k stars 134 forks source link

API not returning next_max_id #231

Open ttptracker opened 11 months ago

ttptracker commented 11 months ago

Does anyone know why the API doesn't return next_max_id for me?

I've attached a screenshot of what it returns.

Thank you for your time.

image

Aerglonus commented 11 months ago

@ttptracker try it like this and see if it works for you


    const mainpage = await threadsAPI.getUserFollowers('userID');
    console.log(mainpage.next_max_id);
    const threads = await threadsAPI.getUserFollowers('userID', {
      maxID: mainpage.next_max_id,
    });
    console.log(JSON.stringify(threads));

or also like this

    const { users, next_max_id: cursor } = await threadsAPI.getUserFollowers(userID);
    console.log(JSON.stringify(users));
    if (cursor) {
      const threads = await threadsAPI.getUserFollowers(userID, {
        maxID: cursor,
      });
      console.log(JSON.stringify(threads));
    }
ttptracker commented 11 months ago

@ttptracker try it like this and see if it works for you

    const mainpage = await threadsAPI.getUserFollowers('userID');
    console.log(mainpage.next_max_id);
    const threads = await threadsAPI.getUserFollowers('userID', {
      maxID: mainpage.next_max_id,
    });
    console.log(JSON.stringify(threads));

or also like this

    const { users, next_max_id: cursor } = await threadsAPI.getUserFollowers(userID);
    console.log(JSON.stringify(users));
    if (cursor) {
      const threads = await threadsAPI.getUserFollowers(userID, {
        maxID: cursor,
      });
      console.log(JSON.stringify(threads));
    }

Thanks for the help. I tried that but still was not able to get the pagination working. This is what it returns for me image