nordhagen / instagram-tagscrape

NPM module for loading images from Instagram by hashtag without API access by means of scraping.
4 stars 8 forks source link

insta 404 error #1

Closed shide1989 closed 7 years ago

shide1989 commented 7 years ago

hi, i think instagram made some changes because when looking at the code, the request return a statusCode 404, and then the module crashes on exports.scrapeTagPage because data.entry_data.TagPage is undefined:

TypeError: Cannot read property '0' of undefined at Request._callback (insta_scrap_test/node_modules/instagram-tagscrape/index.js:36:52) at Request.self.callback (insta_scrap_test/node_modules/request/request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (insta_scrap_test/node_modules/request/request.js:1081:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage.<anonymous> (insta_scrap_test/node_modules/request/request.js:1001:12) at IncomingMessage.g (events.js:291:16) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

ps : on line 35, you might want to add : if (data && data.entry_data && data.entry_data.TagPage)

thanks

shide1989 commented 7 years ago

ok, so instagram simply doesn't allow public access to the explorer anymore. Now you need an account

evolross commented 7 years ago

Indeed... the URL:

https://www.instagram.com/explore/tags/<insert-tag-here>/

...is now unavailable. So does this mean anonymous tag-scraping is impossible now?

shide1989 commented 7 years ago

i guess, unless someone finds a way to sweep in..

23andreas commented 7 years ago

Same thing happened to me, however it seems to be working again now. Checkout https://www.instagram.com/explore/tags/insta/.

Maybe IG decided it was better to allow public access to /explore/?

evolross commented 7 years ago

I revisited this and I realized I was using deepScrapeTagPage which calls scrapePostPage which was broken because IG updated their JSON data model slightly. Forked and PR sent.

Raulvv commented 7 years ago

Yes, actually I got this error with the basic code:

Unhandled rejection TypeError: Cannot read property 'location' of undefined at /Users/Raulvv/Desktop/instagram-scrapper/node_modules/instagram-tagscrape/index.js:14:33 ....

evolross commented 7 years ago

Yeah, you'll need to use my fork until my PR is accepted. I fixed this. I also added more error handling so that when IG changes their JSON model it won't crash your Node process (i.e. crash your entire app) which the current code can do. My fork is https://github.com/evolross/instagram-tagscrape

nordhagen commented 7 years ago

Fixed in 1.0.3