Home > Mobile >  Calculate displayed eth price from opensea current_price in Opensea API
Calculate displayed eth price from opensea current_price in Opensea API

Time:12-11

I'm trying to scrape prices from Opensea website. I managed to get datas from the API, but now i'm stuck as the stated "current_price" in the datas completely differs from what is displayed on the website. for exemple : "current_price":"48070000000000000000.00000000","current_bounty":"480700000000000000","bounty_multiple":"0.01", when the price is actually 58, doesnt seem to make much sense. Hereinafter the code I use. Regards

    import requests
    from bs4 import BeautifulSoup as bs
    import web3

    for tokenid in range(7028, 7029):
        i = str(tokenid)
        url = "https://api.opensea.io/api/v1/asset/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/"   i   "/"

        response = requests.request("GET", url)

        print(response.text)

CodePudding user response:

something like that :

import requests

for tokenid in range(7000, 7029):
    i = str(tokenid)
    url = "https://api.opensea.io/api/v1/asset/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/"   i   "/"
    response = requests.request("GET", url)
    print(response.json()["orders"][0]["current_price"])

> output
46700000000000000000.00000000
46700000000000000000.00000000
46700000000000000000.00000000
  • Related