Created
May 1, 2022 04:30
-
-
Save 2pai/3138f48223ef16ba676c76bc9e8d4361 to your computer and use it in GitHub Desktop.
A Simple script to refresh opensea metadata (Entire collection)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-disable eqeqeq */ | |
| const rax = require('retry-axios'); | |
| const axios = require("axios").default; | |
| axios.defaults.timeout = 30000; | |
| rax.attach(); | |
| const STAGE = "rinkeby"; // "mainnet" | |
| const contractAddress = "0x0000000000000000000000000000000000000000"; | |
| const fromTokenId = 0; | |
| const toTokenId = 10000; | |
| const refresh = async () => { | |
| for (let tokenId = fromTokenId; tokenId <= toTokenId; tokenId++) { | |
| try { | |
| const url = `https://${ | |
| STAGE == "rinkeby" ? "testnets-api" : "api" | |
| }.opensea.io/api/v1/asset/${contractAddress}/${tokenId}/?force_update=true&format=json`; | |
| const data = await axios({ | |
| url: url, | |
| raxConfig: { retry: 10, retryDelay: 5000 }, | |
| }); | |
| console.log(`Done with ${tokenId} ${data.data.name}`); | |
| } catch (error) { | |
| console.log(`Error token ID ${tokenId} : ${error}`); | |
| } | |
| } | |
| }; | |
| refresh(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment