adding testnet
Closed this issue · 12 comments
Hey
What could be nice is adding testnet option to scrap opensea testnet website :)
Is it this one:
https://testnets.opensea.io
Or are there more than 1 sotes?
yep this one
they use Rinkeby eth network
@jack75015 is this still relevant to you? Because I tested and you can simply do this (as a "hack"):
// TESTNET
const res = await OpenseaScraper.offersByUrl("https://testnets.opensea.io/collection/cyberbrokers-v3",options)
// => this gives you testnet results
// MAINNET
const res2 = await OpenseaScraper.offers("cyberbrokers-v3",options);
// => this gives you production results (empty)
closing as testnet scraping is already supported when using offersByUrl
method.
@kaiqiangh I could replicate the issue, the problem is the following:
- the testnet sites usually have a weird page that is displayed in between the actual result page
- just waiting for ~2 seconds before starting the scraping soloves the issue
- unfortunately there is no feature implemented to wait before scraping
I am working on a feature additionalWait
where you can simply add to the options the number of milliseconds to wait before starting to scrape, which should fix the issue.
will post soon once the feature is published on npm.
Thank you very much!
new version with additionalWait
just published (opensea-scraper v6.5.0)
You should be able to overcome this issue like this:
- upgrade to OpenseaScraper v6.5.0 (by running
npm install opensea-scraper@6.5.0
) EDIT: bugfix added, please update to6.5.1
instead:npm install opensea-scraper@6.5.1
. - add an
additionalWait
of ~2-4 seconds:
// TESTNET
const options = {
additionalWait: 4000, // 4 seconds should work, you can try lowering that number
}
const res = await OpenseaScraper.offersByUrl("https://testnets.opensea.io/collection/cyberbrokers-v3",options)
// => this gives you testnet results
let me know if it worked :)
Hi @dcts,
Much appreciated for your quick update.
It works, but there is a minor bug.
the offerURL should be llike "https://testnets.opensea.io/assets/rinkeby/NftAddress/nftID".
Good catch, just fixed it! Please update to newest version:
npm install opensea-scraper@6.5.1
Thanks! It perfectly works now.
great! Closing...!