{"id":20629169,"url":"https://github.com/dcts/opensea-scraper","last_synced_at":"2025-04-06T06:07:01.454Z","repository":{"id":37604529,"uuid":"400894993","full_name":"dcts/opensea-scraper","owner":"dcts","description":"Scrapes nft floor prices and additional information from opensea. Used for https://nftfloorprice.info","archived":false,"fork":false,"pushed_at":"2022-12-20T16:07:29.000Z","size":126,"stargazers_count":185,"open_issues_count":5,"forks_count":72,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T05:04:23.692Z","etag":null,"topics":["cryptocurrency","erc721","nft","nfts","opensea","puppeteer","scraper"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-28T21:37:12.000Z","updated_at":"2024-12-08T18:54:36.000Z","dependencies_parsed_at":"2022-07-10T14:01:15.969Z","dependency_job_id":null,"html_url":"https://github.com/dcts/opensea-scraper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcts%2Fopensea-scraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcts%2Fopensea-scraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcts%2Fopensea-scraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcts%2Fopensea-scraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcts","download_url":"https://codeload.github.com/dcts/opensea-scraper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441044,"owners_count":20939239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptocurrency","erc721","nft","nfts","opensea","puppeteer","scraper"],"created_at":"2024-11-16T13:41:59.282Z","updated_at":"2025-04-06T06:07:01.436Z","avatar_url":"https://github.com/dcts.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Opensea Scraper\n\n**DISCLAIMER**: You can get accurate realtime floor prices from this official opensea API endpoint: `https://api.opensea.io/api/v1/collection/{slug}/stats`:\n```js\nconst axios = require(\"axios\");\n\nasync function getFloorPrice(slug) {\n  try {\n    const url = `https://api.opensea.io/collection/${slug}/stats`;\n    const response = await axios.get(url);\n    return response.data.stats.floor_price;\n  } catch (err) {\n    console.log(err);\n    return undefined;\n  }\n}\n\nawait getFloorPrice(\"lostpoets\");\nawait getFloorPrice(\"treeverse\");\nawait getFloorPrice(\"cool-cats-nft\");\n```\n\nIf 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.\n\n## Install\n\n```bash\nnpm install opensea-scraper\n```\n\n## Usage\n\nℹ **`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}\n![slug](https://user-images.githubusercontent.com/44790691/131232333-b79c50d7-606c-480a-9816-9d750ab798ff.png)\n\nℹ **`options`** is an object with the following keys\n- **`debug`** [Boolean] launches chromium locally, omits headless mode (default: `false`)\n- **`logs`** [Boolean]: display logs in the console (default: `false`)\n- **`sort`** [Boolean]: sorts the offers by lowest to highest (default: `true`)\n- **`additionalWait`** [Number]: time to wait (in milliseconds) after page was loaded before the scraping starts (default: `0`)\n- **`browserInstance`** [PuppeteerBrowser]: bring your own browser instance for more control\n\n```js\nconst OpenseaScraper = require(\"opensea-scraper\");\n\n// which nft project to scrape?\nconst slug = \"cool-cats-nft\";\n\n// options\nconst options = {\n  debug: false,\n  logs: false,\n  sort: true,\n  additionalWait: 0,\n  browserInstance: undefined,\n}\n\n// get basic info (from the opensea API)\nconst basicInfo = await OpenseaScraper.basicInfo(slug);\n\n// get offers from opensea. Each offer includes the \n// floor price, tokenName, tokenId, tokenContractAddress\n// and offerUrl\n// scrapes only the first 20 offers from opensea.\nlet result = await OpenseaScraper.offers(slug, options);\nconsole.dir(result, {depth: null}); // result object contains keys `stats` and `offers`\n\n// get offers from opensea using a custom link\n// Opensea supports encoding filtering in the URL so \n// this method is helpful for getting a specific asset \n// (for example floor price for a deadfellaz with  \n// a purple fur trait)\nlet url = \"https://opensea.io/collection/deadfellaz?search[sortAscending]=true\u0026search[sortBy]=PRICE\u0026search[stringTraits][0][name]=Body\u0026search[stringTraits][0][values][0]=Purple%20Fur\u0026search[toggles][0]=BUY_NOW\";\nresult = await OpenseaScraper.offersByUrl(url, options);\n// result object contains keys `stats` and `offers`\nconsole.dir(result, {depth: null}); \n\n// DISCLAIMER: FUNCTION `offersByScrolling`\n// IS CURRENTLY NOT WORKING (!!!) see [issue#36](https://github.com/dcts/opensea-scraper/issues/36)\n// get offersByScrolling from opensea. This is an \n// alternative method to get the same data as with\n// the function `offers`, with the only difference \n// that the data is here scraped actively by scrolling \n// through the page. This method is not as efficient\n// as the `offers` method, but it can scrape more \n// than 20 offers. You could even scrape a whole \n// collection with ~10k spots (this is not recommended \n// though).\n// IMPORTANT: if you need less than 20 offers, \n// please use the function `offers()` instead\nlet resultSize = 40; \nresult = await OpenseaScraper.offersByScrolling(slug, resultSize, options);\n// result object contains keys `stats` and `offers`\nconsole.dir(result, {depth: null}); \n\n// DISCLAIMER: FUNCTION `offersByScrollingByUrl`\n// IS CURRENTLY NOT WORKING (!!!) see [issue#36](https://github.com/dcts/opensea-scraper/issues/36)\n// get offersByScrollingByUrl from opensea using a \n// custom link instead of the slug. the same logic \n// applies as in `offersByScrolling()`\n// Opensea supports encoding filtering in the URL so \n// this method is helpful for getting a specific asset \n// (for example floor price for a deadfellaz with  \n// a purple fur trait)\n// IMPORTANT: if you need less than 20 offers, \n// please use the function `offersByUrl()` instead\nurl = \"https://opensea.io/collection/deadfellaz?search[sortAscending]=true\u0026search[sortBy]=PRICE\u0026search[stringTraits][0][name]=Body\u0026search[stringTraits][0][values][0]=Purple%20Fur\u0026search[toggles][0]=BUY_NOW\";\nresultSize = 40;\nresult = await OpenseaScraper.offersByScrollingByUrl(url, resultSize, options);\n// result object contains keys `stats` and `offers`\nconsole.dir(result, {depth: null}); \n\n// scrape all slugs, names and ranks from the top collections from the rankings page\n// \"type\" is one of the following:\n//   \"24h\": ranking of last 24 hours: https://opensea.io/rankings?sortBy=one_day_volume\n//   \"7d\": ranking of last 7 days: https://opensea.io/rankings?sortBy=seven_day_volume\n//   \"30d\": ranking of last 30 days: https://opensea.io/rankings?sortBy=thirty_day_volume\n//   \"total\": scrapes all time ranking: https://opensea.io/rankings?sortBy=total_volume\n// \"chain\" is one of the following: \"ethereum\", \"matic\", \"klaytn\", \"solana\"\n//    if chain is unset, all chains will be selected by default\nconst type = \"24h\"; // possible values: \"24h\", \"7d\", \"30d\", \"total\"\nconst chain = \"solana\";\nconst ranking = await OpenseaScraper.rankings(type, chain, options);\n```\n\n### Debugging\n\nTo investigate an issue turn on logs and debug mode (`debug: true` and `logs: true`):\n```js\nconst result = await OpenseaScraper.offers(\"treeverse\", {\n  debug: true,\n  logs: true\n});\n```\n\n### Bring your own puppeteer\n\nif you want to customize the settings for your puppeteer instance you can add your own puppeteer browser instance in the options. **🚧 IMPORTANT**: I recommend using stealth plugin as otherwise you most likely won't be able to scrape opensea. If you find a way without using the stealth plugin please report in the form of an issue!\n```js\nconst puppeteer = require('puppeteer-extra');\n// add stealth plugin and use defaults (all evasion techniques)\nconst StealthPlugin = require('puppeteer-extra-plugin-stealth');\npuppeteer.use(StealthPlugin());\n\nconst myPuppeteerInstance = await puppeteer.launch(myCustomSettings);\n\nconst result = await OpenseaScraper.offer(\"cool-cats-nft\", {\n  browserInstance: myPuppeteerInstance\n});\n```\n\n## Demo\n\n```bash\nnpm run demo\n```\n\n## Run local console / REPL\nTo test the functions in an REPL node environment that has `OpenseaScraper` service preloaded simply run:\n```bash\nnode --experimental-repl-await -i -e \"$(\u003c init-dev-env.js)\"\n```\nI recommend saving an alias:\n```bash\nalias consl='node --experimental-repl-await -i -e \"$(\u003c init-dev-env.js)\"';\n```\n\n## Contribute\n\nOpen PR or issue if you would like to have more features added.\n\n## Donations 🙏\n```\nThanks for your support!\nBTC: bc1qq5qn96ahlqjxfxz2n9l20kem8p9nsz5yzz93f7\nETH: 0x3e4503720Fb8f4559Ecf64BE792b3100722dE940\n```\n\n# nftfloorprice.info 🔔\nSimple NFT floor price alerts. Easily track all your NFTs and receive realtime email alerts with: https://nftfloorprice.info\u003cbr\u003e\u003cbr\u003e\n\u003ca href=\"https://nftfloorprice.info\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/44790691/140594412-b70d93d1-2278-4d27-abf9-74466bee0137.png\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcts%2Fopensea-scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcts%2Fopensea-scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcts%2Fopensea-scraper/lists"}