get all fields from apple podcast

This commit is contained in:
2025-03-28 23:52:46 +08:00
parent fdde34e1f0
commit 70b8e330cc
9 changed files with 285 additions and 496 deletions

126
model/chart_result.go Normal file
View File

@@ -0,0 +1,126 @@
// Package model 提供播客和剧集的数据模型
package model
// ChartResult 表示Apple Podcasts排行榜结果
type ChartResult struct {
Feed Feed `json:"feed"`
}
// Feed 表示排行榜的Feed信息
type Feed struct {
Author Author `json:"author"`
Entry []Entry `json:"entry"`
}
// Author 表示Feed的作者信息
type Author struct {
Name NameLabel `json:"name"`
URI URILabel `json:"uri"`
}
// NameLabel 表示带标签的名称
type NameLabel struct {
Label string `json:"label"`
}
// URILabel 表示带标签的URI
type URILabel struct {
Label string `json:"label"`
}
// Entry 表示排行榜中的一个播客条目
type Entry struct {
Name NameLabel `json:"im:name"`
Image []Image `json:"im:image"`
Summary NameLabel `json:"summary"`
Price Price `json:"im:price"`
ContentType ContentType `json:"im:contentType"`
Rights NameLabel `json:"rights"`
Title NameLabel `json:"title"`
Link Link `json:"link"`
ID ID `json:"id"`
Artist NameLabel `json:"im:artist"`
Category Category `json:"category"`
ReleaseDate ReleaseDate `json:"im:releaseDate"`
}
// Image 表示播客的图片信息
type Image struct {
Label string `json:"label"`
Attributes ImageAttribute `json:"attributes"`
}
// ImageAttribute 表示图片的属性
type ImageAttribute struct {
Height string `json:"height"`
}
// Price 表示播客的价格信息
type Price struct {
Label string `json:"label"`
Attributes PriceAttributes `json:"attributes"`
}
// PriceAttributes 表示价格的属性
type PriceAttributes struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
}
// ContentType 表示内容类型
type ContentType struct {
Attributes ContentTypeAttributes `json:"attributes"`
}
// ContentTypeAttributes 表示内容类型的属性
type ContentTypeAttributes struct {
Term string `json:"term"`
Label string `json:"label"`
}
// Link 表示链接信息
type Link struct {
Attributes LinkAttributes `json:"attributes"`
}
// LinkAttributes 表示链接的属性
type LinkAttributes struct {
Rel string `json:"rel"`
Type string `json:"type"`
Href string `json:"href"`
}
// ID 表示播客的ID信息
type ID struct {
Label string `json:"label"`
Attributes IDAttributes `json:"attributes"`
}
// IDAttributes 表示ID的属性
type IDAttributes struct {
ID string `json:"im:id"`
}
// Category 表示播客的分类信息
type Category struct {
Attributes CategoryAttributes `json:"attributes"`
}
// CategoryAttributes 表示分类的属性
type CategoryAttributes struct {
ID string `json:"im:id"`
Term string `json:"term"`
Scheme string `json:"scheme"`
Label string `json:"label"`
}
// ReleaseDate 表示发布日期信息
type ReleaseDate struct {
Label string `json:"label"`
Attributes ReleaseDateAttributes `json:"attributes"`
}
// ReleaseDateAttributes 表示发布日期的属性
type ReleaseDateAttributes struct {
Label string `json:"label"`
}

74
model/feed_entry.go Normal file
View File

@@ -0,0 +1,74 @@
// Package model 提供播客和剧集的数据模型
package model
// FeedEntry 表示 Apple Podcasts RSS Feed 中的一个条目
type FeedEntry struct {
Name struct {
Label string `json:"label"`
} `json:"im:name"`
Image []struct {
Label string `json:"label"`
Attributes struct {
Height string `json:"height"`
} `json:"attributes"`
} `json:"im:image"`
Summary struct {
Label string `json:"label"`
} `json:"summary"`
Price struct {
Label string `json:"label"`
Attributes struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
} `json:"attributes"`
} `json:"im:price"`
ContentType struct {
Attributes struct {
Term string `json:"term"`
Label string `json:"label"`
} `json:"attributes"`
} `json:"im:contentType"`
Rights struct {
Label string `json:"label"`
} `json:"rights"`
Title struct {
Label string `json:"label"`
} `json:"title"`
Link struct {
Attributes struct {
Rel string `json:"rel"`
Type string `json:"type"`
Href string `json:"href"`
} `json:"attributes"`
} `json:"link"`
ID struct {
Label string `json:"label"`
Attributes struct {
ID string `json:"im:id"`
} `json:"attributes"`
} `json:"id"`
Artist struct {
Label string `json:"label"`
} `json:"im:artist"`
Category struct {
Attributes struct {
ID string `json:"im:id"`
Term string `json:"term"`
Scheme string `json:"scheme"`
Label string `json:"label"`
} `json:"attributes"`
} `json:"category"`
ReleaseDate struct {
Label string `json:"label"`
Attributes struct {
Label string `json:"label"`
} `json:"attributes"`
} `json:"im:releaseDate"`
}
// FeedResponse 表示 Apple Podcasts RSS Feed 的响应
type FeedResponse struct {
Feed struct {
Entry []FeedEntry `json:"entry"`
} `json:"feed"`
}

21
model/lookup_result.go Normal file
View File

@@ -0,0 +1,21 @@
// Package model 提供播客和剧集的数据模型
package model
import (
"time"
)
// SearchResult2 表示iTunes API搜索或查询的结果
type LookupResult struct {
// 结果数量
ResultCount int `json:"resultCount"`
// 搜索是否成功
Successful bool `json:"successful,omitempty"`
// 搜索结果项目列表
Items []ApplePodcast `json:"results"`
// 处理时间
ProcessedTime time.Time `json:"processedTime,omitempty"`
}

View File

@@ -43,3 +43,18 @@ type SearchResult struct {
// 处理时间
ProcessedTime time.Time `json:"processedTime,omitempty"`
}
// SearchResult 表示播客搜索的结果
type SearchResult2 struct {
// 结果数量
ResultCount int `json:"resultCount,omitempty"`
// 搜索是否成功
Successful bool `json:"successful,omitempty"`
// 搜索结果项目列表
Items []ApplePodcast `json:"items,omitempty"`
// 处理时间
ProcessedTime time.Time `json:"processedTime,omitempty"`
}