0

I have such a problem...

I need to parse a certain page of the site.For this I used axios or needle.

The problem is that when I run the project locally and want to get the data, everything works fine.

But when I run the project on heroku and call the method to get the html page from the site, the site returns me the page "Please enable cookies".

I tried adding various additional parameters to the header but it doesn't help me

Example of a function:

let response = await axios.get(url);

let data = response.data;

var $ = cheerio.load(data);

OR

needle.get(URL, function (err, res) {
 if (err) console.log("ERR: ", err);
 let body = res.body;
 var $ = cheerio.load(body);
});

What do I need to do to get a site page?

Ilya K
  • 93
  • 8
  • If the issue really is cookies from one request to the next, axios cookie jar: https://www.npmjs.com/package/axios-cookiejar-support. – jfriend00 May 31 '21 at 02:14
  • @jfriend00 I tried using this package. But I get the error: "message":"Request failed with status code 503","name":"Error","stack":"Error: Request failed with status code 503 – Ilya K May 31 '21 at 11:31

0 Answers0