Ответ держите возврат Код состояния 403 вместо 200 - PullRequest
0 голосов
/ 30 января 2020

Я пытаюсь получить Статус 200 ответ на мой запрос, но продолжаю получать 403

const request = require('request');
const cheerio = require('cheerio');

let options = {
  url: 'https://www.norwegian.com/en',
  headers: {
    "Cache-Control": "max-age=0",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "en-US,en;q=0.5",
    "Connection": "keep-alive",
    "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0",
  }
};

request(options, function (err, resp, html) {
  if (!err) {
    const gatherInformation = cheerio.load(html);
    console.log(resp.statusCode);
  }
})

Мой заголовок запроса в соответствии с Firefox dev tools: enter image description here

...