package main import ( "fmt" "gitea.malaihome.work/ans/podcast-search-go/model" "gitea.malaihome.work/ans/podcast-search-go/search" ) func main() { provider := search.NewITunesProvider() // podcast, err := provider.SearchPodcasts("golang", &search.SearchOptions{Country: "us", Language: "en-us"}) podcast, err := provider.Charts(&search.ChartsOptions{Country: "us", GenreID: model.GetGenreID("en-US", "Art"), Limit: 3}) if err != nil { panic(err) } // print podcast to json fmt.Printf("podcast count: %+v\n", len(podcast.Items)) item := podcast.Items[0] fmt.Printf("name: %s, feedUrl: %s\n", item.CollectionName, item.FeedURL) feedUrl := "http://www.ximalaya.com/album/19206382.xml" pod, err := model.LoadFeed(feedUrl) if err != nil { panic(err) } for _, e := range pod.Episodes[:2] { fmt.Printf("episode: %+v\n", e) } }