22 lines
751 B
Python
22 lines
751 B
Python
import requests
|
|
import random
|
|
|
|
|
|
def get_nft():
|
|
|
|
# To find the collection's address, you have to do a curl against the API
|
|
# curl -s --request GET --url https://api.opensea.io/api/v1/collection/<collection name here> | | jq -r .[].primary_asset_contracts[].address
|
|
collections = [
|
|
"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
|
|
"0xbd3531da5cf5857e7cfaa92426877b022e612cf8",
|
|
"0x54a79ab6f5210fcb2c5fc914271a865003f15576",
|
|
"0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb",
|
|
]
|
|
url = (
|
|
"https://api.opensea.io/api/v1/bundles?limit=50&asset_contract_address=%s"
|
|
% random.choice(collections)
|
|
)
|
|
x = requests.get(url).json()["bundles"]
|
|
|
|
return random.choice(x)["assets"][0]["image_url"]
|