Code Monkey home page Code Monkey logo

Comments (6)

dcts avatar dcts commented on May 20, 2024

Can you provide a code snipped and the result you get so I can check what the problem is? Thanks!

from opensea-scraper.

kaiqiangh avatar kaiqiangh commented on May 20, 2024
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:

328aea9680ae3202ca8c3aae66ea6aa

from opensea-scraper.

dcts avatar dcts commented on May 20, 2024

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});
}

from opensea-scraper.

kaiqiangh avatar kaiqiangh commented on May 20, 2024

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

from opensea-scraper.

dcts avatar dcts commented on May 20, 2024

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:

  • with "output" do you mean the number of results?
  • were you curious why it was only 5 offers OR did you recieve a lot of offers but actually wanted to just return the top 5 offers?

from opensea-scraper.

dcts avatar dcts commented on May 20, 2024

thanks @kaiqiangh for the fix! 🎉

from opensea-scraper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.