preethamvishy / instapro

A Node.js library to get a wide range of public Instagram data without API keys or logging in. https://www.npmjs.com/package/instapro
MIT License
54 stars 18 forks source link

Check status code when requesting user page #5

Closed michael-dm closed 5 years ago

michael-dm commented 5 years ago

Currently the script throws this error on functions requesting a user page : /node_modules/instapro/index.js:15 resolve(JSON.parse(eleHTML.split('"ProfilePage":[')[1].split(']},"hostname"')[0]).graphql.user); TypeError: Cannot read property 'split' of undefined

It is solved by checking the status code of the request, a 404 means the user doesn't exists.