如何使用 node js 从 opensea 抓取网站

How to scrape a website from opensea using node js

我未能尝试从 Opensea 中抓取一组多边形 NFT。有人可以提供一个打印控制台返回的 html 的示例吗?我试过下面的代码:

const https = require("https");

https.get("https://opensea.io/collection/orathai", response => {
        console.log(response)

});
const axios = require('axios').default;

axios.get('https://api.opensea.io/api/v1/collection/orathai/?format=json')
    .then(resp => {
        console.log(resp.data);
    })
    .catch(err => {
        // Handle Error Here
        console.error(err);
    });

别忘了:npm i axios

参考:

opensea api docs

Axios