简体   繁体   中英

Calculate displayed eth price from opensea current_price in Opensea API

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM