instagram-private-api
instagram-private-api copied to clipboard
IgNotFoundError
Code
async function getLatestPostOrReel(username) {
const userFeed = ig.feed.user(username);
const timelineFeed = ig.feed.timeline();
const [userMediaItems, timelineMediaItems] = await Promise.all([
userFeed.items(),
timelineFeed.items()
]);
const latestMediaItem = [...userMediaItems, ...timelineMediaItems].sort((a, b) => b.taken_at_timestamp - a.taken_at_timestamp)[0];
return latestMediaItem;
}
Error
return new errors_1.IgNotFoundError(response);
^
IgNotFoundError: GET /api/v1/feed/user/username/ - 404 Not Found;
at Request.handleResponseError (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/core/request.js:103:20)
at Request.send (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/core/request.js:54:28)
at async UserFeed.request (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/feeds/user.feed.js:21:26)
at async UserFeed.items (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/feeds/user.feed.js:31:22)
at async Promise.all (index 0)
at async getLatestPostOrReel (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/Events/ready.5.js:47:58)
at async Timeout.main [as _onTimeout] (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/Events/ready.5.js:72:35)
I am trying to get the latest post of a user.
Same problem