{"id":18369803,"url":"https://github.com/cawfree/collection-slug","last_synced_at":"2025-08-17T11:11:34.416Z","repository":{"id":65798409,"uuid":"600010884","full_name":"cawfree/collection-slug","owner":"cawfree","description":"🧸 🤖 Determine the collection slug for a collection on OpenSea.","archived":false,"fork":false,"pushed_at":"2023-04-19T21:54:26.000Z","size":242,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-03T13:49:01.087Z","etag":null,"topics":["archive","collection","erc1159","erc721","nft","non-fungible","opensea","slug","token","wayback-machine","web"],"latest_commit_sha":null,"homepage":"https://twitter.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cawfree.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-10T11:35:29.000Z","updated_at":"2023-12-17T18:44:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"712fca20-f910-45cd-bfd8-5035a3f8074d","html_url":"https://github.com/cawfree/collection-slug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cawfree/collection-slug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Fcollection-slug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Fcollection-slug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Fcollection-slug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Fcollection-slug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cawfree","download_url":"https://codeload.github.com/cawfree/collection-slug/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Fcollection-slug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270837583,"owners_count":24654391,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["archive","collection","erc1159","erc721","nft","non-fungible","opensea","slug","token","wayback-machine","web"],"created_at":"2024-11-05T23:32:13.291Z","updated_at":"2025-08-17T11:11:34.402Z","avatar_url":"https://github.com/cawfree.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `collection-slug`\n🧸 🤖 Determine the collection slug for a collection on [__OpenSea__](https://opensea.io).\n\nAt the time of writing, the [__OpenSea API__](https://docs.opensea.io/reference/api-overview):\n- does not serve information about layer twos like [__Arbitrum__](https://arbitrum.io/) and [__Optimism__](https://www.optimism.io/)\n- will prevent you from querying for collection data when only knowing the `contractAddress` and not a corresponding `tokenId`\n- relies upon a centrally-planned api key distribution system which restricts access to intrepid explorers\n- shrewdly prevents you from querying GraphQL using the now deprecated [`opensea-submarine`](https://github.com/cawfree/opensea-submarine)⚠️\n- will throttle you to oblivion if you exceed 4 req/s and your backoff period will increase quadratically as a penalty for repeat offenders\n- protected their webpages against scrapers by firewalling requests behind [__CloudFlare__](https://www.cloudflare.com/en-gb/) and DOM obfuscation\n\nAnd yet, everyone who works with [__NFTs__](https://ethereum.org/en/nft/) all need `collection_slug`s, desperately, every one of us. We need `collection_slug`s like fish need water. 🐟\n\nI was researching how to bypass these limitations and encountered [__an article__](https://scrapeops.io/web-scraping-playbook/how-to-bypass-cloudflare/) that suggested we could work around such access restrictions by using archived copies of webpages... So here we are. OpenSea collection slugs, powered by the [__Wayback Machine__](https://web.archive.org/). They're surprisingly timely, even for newly trending collections. Let's go.\n\n### getting started 🚀\n\nYou can install using [__Yarn__](https://yarnpkg.com):\n\n```shell\nyarn add bottleneck collection-slug\n```\n\nDepending on your runtime, you'll need to ensure some kind of variation of [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) is globally available. This is polyfilled onto the `window` object by default on browsers and [__React Native__](https://reactnative.dev), whereas on [__Node.js__](https://nodejs.org/en/) you'll need to install [`node-fetch`](https://www.npmjs.com/package/node-fetch).\n\n```typescript\nimport { fetchCollectionSlug, Network } from 'collection-slug';\n\nvoid (async () =\u003e {\n  try {\n    const collectionSlug: string = await fetchCollectionSlug({\n      contractAddress: '0xef0182dc0574cd5874494a120750fd222fdb909a',\n      network: Network.ETHEREUM /* default */,\n    });\n    \n    console.log(collectionSlug); // 'rumble-kong-league'\n  } catch (e) {\n    console.error(e); // not indexed by the wayback machine\n    process.exitCode = 1;\n  }\n})();\n```\n\nYou can also do the inverse:\n\n```typescript\nimport { fetchContractAddress } from 'collection-slug';\n\nvoid (async () =\u003e {\n  try {\n    const contractAddress: string = await fetchContractAddress({\n      collectionSlug: 'renftlabs',\n    });\n    console.log(contractAddress); // '0x0db8c099b426677f575d512874d45a767e9acc3c'\n  } catch (e) {\n    console.error(e); // not indexed by the wayback machine\n    process.exitCode = 1;\n  }\n})();\n```\n\nFrom my [__experimentation__](scripts/rate-limit.ts), the Wayback Machine has a very generous rate limit policy. I managed to retain a sustained ~112 slugs-per-minute without error.\n\n### license ✌️\n[__CC0-1.0__](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawfree%2Fcollection-slug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcawfree%2Fcollection-slug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawfree%2Fcollection-slug/lists"}