如何发出提取请求

时间:2020-06-18 17:11:13

标签: javascript node.js fetch

我想调用另一个站点api,我在node js中使用了访存,但是我遇到了一些问题。可以请求从以下api获取数据:https://u.gg/lol/champions/khazix/probuilds

我不会使用puppeteer,因为它会变慢。

如果我将链接放在邮递员中,则可以工作,但不能提取

fetch("https://u.gg/lol/champions/khazix/probuilds", {
  "headers": {
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "accept-language": "it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7",
    "cache-control": "max-age=0",
    "sec-fetch-dest": "document",
    "sec-fetch-mode": "navigate",
    "sec-fetch-site": "same-origin",
    "sec-fetch-user": "?1",
    "upgrade-insecure-requests": "1",
  },
  "referrerPolicy": "no-referrer-when-downgrade",
  "body": null,
  "method": "GET",
  "mode": "no-cors",
  "credentials": "include"
})
.then(res => res.json())
.then(data => console.log(data))

0 个答案:

没有答案