instagram-api icon indicating copy to clipboard operation
instagram-api copied to clipboard

SyntaxError: Unexpected token < in JSON at position 0(…)

Open zskynar opened this issue 8 years ago • 1 comments

When I use userSelfMedia() it comes back correct and I get the correct info but when I try to call a specific user it comes back..


SyntaxError: Unexpected token < in JSON at position 0( at Object.parse (native) at IncomingMessage. (/node_modules/instagram-api/lib/instagram.js:71:20) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:973:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)).


Is there something I'm doing wrong?

Doesnt Work instagramAPI.userMedia('user_id').then(function(result) { console.log(result.data); console.log(result.limit); console.log(result.remaining); }, function(err){ console.log(err); // error info }); }

Works instagramAPI.userSelfMedia('user_id').then(function(result) { console.log(result.data); console.log(result.limit); console.log(result.remaining); }, function(err){ console.log(err); // error info }); }

zskynar avatar Nov 01 '16 19:11 zskynar

Are you actually sending the user_id in instagramAPI.userMedia ? instagramAPI.userSelfMedia probably works because it doesn't need a user_id, it uses the userID of who created the accessToken / makes the request.

You need to send which user to grab in the first request like: instagramAPI.userMedia('5482639').then...

mkral avatar Dec 21 '16 17:12 mkral