简体   繁体   English

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

[英]How to scrape a website from opensea using node js

I'm failing at trying to scrape a collection of polygon NFTs from Opensea.我未能尝试从 Opensea 中抓取一组多边形 NFT。 Could someone please provide an example that prints the html returned in console?有人可以提供一个打印控制台返回的 html 的示例吗? I tried the code below:我尝试了下面的代码:

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);
    });

don't forget: npm i axios不要忘记: npm i axios

Refrence:参考:

opensea api docs opensea api 文档

Axios Axios

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM