Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot get price #61

Closed
0xMarsRover opened this issue Jul 13, 2022 · 10 comments
Closed

[BUG] Cannot get price #61

0xMarsRover opened this issue Jul 13, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@0xMarsRover
Copy link

Hi,

I used two scripts below for getting prices of nfts, but all failed. I remembered that I can get prices by using function "offers" or "offersByUrl" before, but they do not work now.
Script 1:
let result_testnet = await OpenseaScraper.offersByUrl("https://testnets.opensea.io/collection/doodles-officias", options); console.dir(result_testnet, {depth: null}); // result object contains keys stats and offers
image

Script 2:
let result = await OpenseaScraper.offers(nft, options); console.dir(result, {depth: null}); // result object contains keys stats and offers
image

Any suggestions for that? Thanks.

@dcts
Copy link
Owner

dcts commented Jul 13, 2022

thanks a lot, its a bug, working on it.

@0xMarsRover
Copy link
Author

Thanks for your response. I think opensea website Could have updates somewhere.

@dcts
Copy link
Owner

dcts commented Jul 13, 2022

So opensea changed some variable names in their __wired__ variable (we get the prices from that variable).

I noticed that quantityInEth is not longer availible. Instead only quantity seems to exist.

// doesnt work anymore
Object.values(__wired__.records)
    .filter(o => o.__typename === "AssetQuantityType")
    .filter(o => o.quantityInEth) // ❌ this breaks

// seems to work 
Object.values(__wired__.records)
    .filter(o => o.__typename === "AssetQuantityType")
    .filter(o => o.quantity) // returns something but with wrong mapping

Unfortunately simply chaning this does NOT fix the issue, because the mapping is off. This needs more investigation. Leaving my findings here for now.

@dcts dcts added the bug Something isn't working label Jul 13, 2022
@0xMarsRover
Copy link
Author

So opensea changed some variable names in their __wired__ variable (we get the prices from that variable).

I noticed that quantityInEth is not longer availible. Instead only quantity seems to exist.

// doesnt work anymore
Object.values(__wired__.records)
    .filter(o => o.__typename === "AssetQuantityType")
    .filter(o => o.quantityInEth) // ❌ this breaks

// seems to work 
Object.values(__wired__.records)
    .filter(o => o.__typename === "AssetQuantityType")
    .filter(o => o.quantity) // returns something but with wrong mapping

Unfortunately simply chaning this does NOT fix the issue, because the mapping is off. This needs more investigation. Leaving my findings here for now.

Is there any updates on this issue? Thanks

@dcts
Copy link
Owner

dcts commented Aug 5, 2022

I currently don't have time to fix this. I have it on my todo list, but I cannot promise nor predict any timeline.

@0xMarsRover
Copy link
Author

Thnaks for your reply.

I currently don't have time to fix this. I have it on my todo list, but I cannot promise nor predict any timeline.

@0xMarsRover
Copy link
Author

0xMarsRover commented Aug 16, 2022

I did some investigations on Opensea website abnd made some changes on source code. Now it seems work.

const floorPrices = Object.values(__wired__.records)
  .filter(o => o.__typename === "PriceType" && o.eth && o.unit && o.usd)
  .filter(o => o.eth)
  .map(o => {
    return {
      amount: o.eth,
      currency: 'ETH',
    }
  });

@ankerbachryhl
Copy link

I did some investigations on Opensea website abnd made some changes on source code. Now it seems work.

const floorPrices = Object.values(__wired__.records) .filter(o => o.__typename === "PriceType" && o.eth && o.unit && o.usd) .filter(o => o.eth) .map(o => { return { amount: o.eth, currency: 'ETH', } }); image

this works!! thank you!

@dcts
Copy link
Owner

dcts commented Aug 19, 2022

thanks @kaiqiangh for the fix! I adapted it in the new version 6.5.2. To adapt please use version 6.5.2:

npm install opensea-scraper@6.5.2

or alternatively if you have it already installed upgrade to latest version

npm upgrade

Thank you! ♥️

@0xMarsRover
Copy link
Author

thanks @kaiqiangh for the fix! I adapted it in the new version 6.5.2. To adapt please use version 6.5.2:

npm install opensea-scraper@6.5.2

or alternatively if you have it already installed upgrade to latest version

npm upgrade

Thank you! ♥️

All good! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants