Gathering detailed insights and metrics for opensea-scraper-ts
Gathering detailed insights and metrics for opensea-scraper-ts
Gathering detailed insights and metrics for opensea-scraper-ts
Gathering detailed insights and metrics for opensea-scraper-ts
Scrapes nft floor prices from opensea. Not using the API because the floor prices returned are inaccurate and do not match the actual real floor prices.
npm install opensea-scraper-ts
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
105 Commits
10 Branches
1 Contributors
Updated on 01 Dec 2021
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
3
Compared to previous day
Last week
0%
4
Compared to previous week
Last month
320%
42
Compared to previous month
Last year
-16.8%
233
Compared to previous year
🎉 UPDATE 2021-Nov-3: Opensea officially updated their API. You can get accurate realtime floor prices from this endpoint: https://api.opensea.io/api/v1/collection/{slug}/stats
:
1const axios = require("axios"); 2 3async function getFloorPrice(slug) { 4 try { 5 const url = `https://api.opensea.io/collection/${slug}/stats`; 6 const response = await axios.get(url); 7 return response.data.stats.floor_price; 8 } catch (err) { 9 console.log(err); 10 return undefined; 11 } 12} 13 14await getFloorPrice("lostpoets"); 15await getFloorPrice("treeverse"); 16await getFloorPrice("cool-cats-nft");
If you need floor prices, please use the official API (see above 👆👆👆). This scraper still can be used to scrape additional information about offers (tokenId, name, tokenContractAddress and offerUrl) as well as the ranking.
1npm install opensea-scraper
ℹ slug
is the human readable identifier that opensea uses to identify a collection. It can be extracted from the URL: https://opensea.io/collection/{slug}
ℹ options
is an object with the following keys
debug
[Boolean] launches chromium locally, omits headless mode (default: false
)logs
[Boolean]: display logs in the console (default: false
)sort
[Boolean]: sorts the offers by lowest to highest (default: true
)browserInstance
[PuppeteerBrowser]: bring your own browser instance for more control1const OpenseaScraper = require("opensea-scraper"); 2 3// which nft project to scrape? 4const slug = "cool-cats-nft"; 5 6// options 7const options = { 8 debug: false, 9 logs: false, 10 sort: true, 11 browserInstance: undefined, 12} 13 14// get basic info (from the opensea API) 15const basicInfo = await OpenseaScraper.basicInfo(slug); 16 17// get offers from opensea. Each offer includes the floor price, tokenName, 18// tokenId, tokenContractAddress and offerUrl 19let result = await OpenseaScraper.offers(slug, options); 20console.dir(result, {depth: null}); // result object contains keys `stats` and `offers` 21 22// get offers from opensea using a custom link 23// Opensea supports encoding filtering in the URL so this method is helpful for getting 24// a specific asset (for example floor price for a LAND token from the sandbox collection) 25const url = "https://opensea.io/collection/sandbox?search[sortAscending]=true&search[sortBy]=PRICE&search[stringTraits][0][name]=Type&search[stringTraits][0][values][0]=Land&search[toggles][0]=BUY_NOW"; 26result = await OpenseaScraper.offersByUrl(url, options); 27console.dir(result, {depth: null}); // result object contains keys `stats` and `offers` 28 29// scrape all slugs, names and ranks from the top collections from the rankings page 30// sorted by all time volume => https://opensea.io/rankings?sortBy=total_volume 31// `nbrOfPages` specifies how many pages should be scraped (1 page = 100 collections) 32const nbrOfPages = 2; 33const ranking = await OpenseaScraper.rankings(nbrOfPages, options);
To investigate an issue turn on logs and debug mode (debug: true
and logs: true
):
1const result = await OpenseaScraper.offers("treeverse", { 2 debug: true, 3 logs: true 4});
if you want to customize the settings for your puppeteer instance you can add your own puppeteer browser instance in the options:
1const puppeteer = require("puppeteer"); 2const myPuppeteerInstance = await puppeteer.launch(myCustomSettings); 3 4const result = await OpenseaScraper.offer("cool-cats-nft", { 5 browserInstance: myPuppeteerInstance 6});
1npm run demo
Open PR or issue if you would like to have more features added.
Thanks for your support!
BTC: bc1qq5qn96ahlqjxfxz2n9l20kem8p9nsz5yzz93f7
ETH: 0x3e4503720Fb8f4559Ecf64BE792b3100722dE940
Simple NFT floor price alerts. Easily track all your NFTs and receive realtime email alerts with: https://nftfloorprice.info
No vulnerabilities found.
No security vulnerabilities found.