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 if user exists #4

Closed michael-dm closed 5 years ago

michael-dm commented 5 years ago

Hello ! Currently the getUserByUsername function throws an error if the instagram user does not exists : /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

Would it be possible to check if the user exists and reject the promise instead ? Or maybe create a checkUserExistsByUsername function ?

Edit : same for getUserIdFromUsername Edit 2 : I made a pull request

Thanks !

preethamvishy commented 5 years ago

Hey, thanks for adding graceful handling for non-existent users. I have merged the PR and therefore, I'm closing this issue for now.