rzlyp / instagram-scraping

NodeJS module for scraping instagram media by hashtag
109 stars 23 forks source link

How to catch an error while debugging? #25

Open oshliaer opened 3 years ago

oshliaer commented 3 years ago

Looking for tips on how to catch an error while debugging on Google Cloud Functions.

2021-07-21 18:28:25.656 MSK helloGET bd6bvi5eeq9v Function execution started
2021-07-21 18:28:26.846 MSK helloGET bd6bvi5eeq9v Error: Error scraping user page "jcvrnd19"
2021-07-21 18:28:26.846 MSK helloGET bd6bvi5eeq9v at /workspace/node_modules/instagram-scraping/index.js:59:24
2021-07-21 18:28:26.846 MSK helloGET bd6bvi5eeq9v at processTicksAndRejections (internal/process/task_queues.js:95:5) Error scraping user page "jcvrnd19" Error: Error scraping user page "jcvrnd19"
at processTicksAndRejections (internal/process/task_queues.js:95:5) Error scraping user page "jcvrnd19" Error: Error scraping user page "jcvrnd19"
2021-07-21 18:28:26.846 MSK helloGET bd6bvi5eeq9v at /workspace/node_modules/instagram-scraping/index.js:59:24
2021-07-21 18:28:26.846 MSK helloGET bd6bvi5eeq9v at processTicksAndRejections (internal/process/task_queues.js:95:5)
var ig = require('instagram-scraping');
/**
 *
 */
exports.helloGET = (req, res) => {
  ig.scrapeUserPage('jcvrnd19')
    .then((result) => {
      console.dir(result);
      res.send(result);
    })
    .catch((err) => {
      console.error(err, err.message, err.stack);
      res.status(500).send(err.message);
    });
};

So... Is a really good idea to raise this silent issue https://github.com/rzlyp/instagram-scraping/blob/master/index.js#L59 ?

This works fine for me for local or a real/VM server (not a micro service)

yepMad commented 3 years ago

I have no problems running locally, but on my machine (DigitalOcean) I have the same problem

oshliaer commented 3 years ago

@yepMad , this happens because Instagram blocks ips of Google, Digital Ocean, etc. You need to use a proxy for to scrape.