在 opensea 上批量刷新元数据

问题描述 投票:0回答:0

我现在遇到了一个大问题......我最近一直在研究一个 nft 系列,几天前才透露了这个系列。元数据就像在大多数图像上发生的错误索引一样混乱。现在,我已经将新的元数据更新并加载到智能合约中。事实上,如果我去 opensea,从集合中选择一个项目,打开它,然后单击刷新元数据按钮,等待几秒钟并刷新页面后......该项目的元数据显示是正确的。

问题是我不能去打开每个项目来一个一个地刷新它,对吧?!该合集是10'000件合集...所以我希望你能理解我的意思...这太令人沮丧了...Opensea真的应该提供批量刷新的机会吗?

无论如何,你能不能给我推荐一个脚本,我可以用 python 运行它并运行一个 for 循环来刷新这些项目?

https://api.opensea.io/api/v1//asset/{合约地址}/{token_id}/?force_update=true

我知道如果没有来自 opensea 的 API,运行它是行不通的;我已经提交了一个请求,但是他们似乎在忙着做其他事情……我对此感到绝望;如果我要求,opensea 团队会为我批量刷新吗?!

有什么建议吗?!谢谢 StackOverflow 社区 :)

```python


import requests
import time

endpoint = "https://api.opensea.io/api/v1"
collection_slug = "sparkling-luna"

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "X-API-KEY": "your_api_key_here"
}

for token_id in range(10000):
    url = f"{endpoint}/asset/{collection_slug}/{token_id}/?force_update=true"
    response = requests.request("PUT", url, headers=headers)
    
    if response.status_code == 200:
        print(f"Refreshed metadata for token {token_id}")
    else:
        print(f"Failed to refresh metadata for token {token_id}")
    
    time.sleep(1

)

``

我尝试运行此脚本并取出标头以在没有 API 的情况下尝试...但没有,似乎该脚本只能与 opensea api 一起使用...对吗?

python collections metadata refresh opensea
© www.soinside.com 2019 - 2024. All rights reserved.