Closed 0xMarsRover closed 2 years ago
Can you provide a code snipped and the result you get so I can check what the problem is? Thanks!
const OpenseaScraper = require("opensea-scraper");
run()
async function run(){
const options = {
debug: false,
logs: false,
sort: true,
browserInstance: undefined,
}
let nft = 'otherdeed'
let url = `https://opensea.io/collection/${nft}?search[sortAscending]=true
&search[sortBy]=PRICE
&search[toggles][0]=BUY_NOW`
let resultSize = 5; // if you need less than 32 offers, please use the function offers() instead
let result = await OpenseaScraper.offersByScrollingByUrl(url, resultSize, options);
console.dir(result, {depth: null}); // result object contains keys stats and offers
}
The screenshot of my result is shown below:
This is a good catch, as of current state the offersByScrollingByUrl
function seems to be broken. In fact, all function that include byScrolling
are currently still broken (see open issue #36).
But in the snippet you provided I see no need to use offersByScrolling
, you could simply use the offers
function:
const OpenseaScraper = require("opensea-scraper");
run();
async function run(){
const options = {
debug: false,
logs: false,
sort: true,
browserInstance: undefined,
};
let nft = 'otherdeed';
let result = await OpenseaScraper.offers(nft, options);
console.dir(result, {depth: null});
}
Thanks for your suggestion. It works!
I would confirm one thing - if I use offers
function, is there a way to control the number of outputs (for example, I'd only get 5 outputs from this function)?
Thanks
offers()
and offersByUrl()
by default return 32 results (but is currently broken, see #61). The only time it will return less than 32 results is when there are less than 32 items currently on sale (this might happen if you input an url that has a lot of filtering of traits, e.g. OpenseaScraper.offersByUrl("https://opensea.io/collection/boredapeyachtclub?search[sortAscending]=true&search[sortBy]=PRICE&search[stringTraits][0][name]=Clothes&search[stringTraits][0][values][0]=Black%20T&search[stringTraits][1][name]=Eyes&search[stringTraits][1][values][0]=Bored&search[toggles][0]=BUY_NOW"))
I am also not sure if I understand your question correctly. Can you specify:
thanks @kaiqiangh for the fix! 🎉
I cannot get any result for floor price from a NFT on opensea. I used the same code as before (it worked), but now it does not work. I would wonder - is it caused by opensea website upgrade? Thanks.