diff --git a/main.go b/main.go index d515c52..637bdeb 100644 --- a/main.go +++ b/main.go @@ -88,7 +88,7 @@ func getRandomOpenSeaAsset() (Asset, error) { if len(a.ImageUrl) == 0 { continue } - id := getOpenSeaId(a.TokenId) + id := getOpenSeaId(a.Id) file, err := os.Open(filepath.Join(NFTS_DIR, id)) defer file.Close() if errors.Is(err, fs.ErrNotExist) { @@ -114,7 +114,7 @@ func (d downloadedOpenSeaAsset) IsVideo() bool { } func downloadOpenSeaAsset(asset Asset, transaction Transaction) (string, error) { - id := getOpenSeaId(asset.TokenId) + id := getOpenSeaId(asset.Id) u, err := url.Parse(asset.ImageUrl) if err != nil { diff --git a/opensea.go b/opensea.go index 0a7439f..233cad7 100644 --- a/opensea.go +++ b/opensea.go @@ -8,6 +8,7 @@ import ( // https://docs.opensea.io/reference/asset-object type Asset struct { + Id string TokenId string Permalink string ImageUrl string @@ -26,6 +27,7 @@ type Assets []Asset func GetAssets() (Assets, error) { parsed := struct { Assets []struct { + Id uint64 `json:"id"` TokenId string `json:"token_id"` Permalink string `json:"permalink"` ImageUrl string `json:"image_url"` @@ -59,6 +61,7 @@ func GetAssets() (Assets, error) { return assets, err } assets = append(assets, Asset{ + Id: strconv.FormatUint(a.Id, 10), TokenId: a.TokenId, Permalink: a.Permalink, ImageUrl: a.ImageUrl,