feat(search): add logging, rate limiting, and genre ID support
Enhance the ITunesProvider by adding logging with detailed caller information, implementing rate limiting to prevent API abuse, and supporting genre IDs for more precise searches. Also, update the User-Agent string and improve error handling and logging throughout the search and charts functionality.
This commit is contained in:
5
main.go
5
main.go
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gitea.malaihome.work/ans/podcast-search-go/model"
|
||||
"gitea.malaihome.work/ans/podcast-search-go/search"
|
||||
)
|
||||
|
||||
@@ -11,12 +12,12 @@ 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", Language: "en-us", Limit: 10})
|
||||
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: %+v\n", podcast)
|
||||
fmt.Printf("podcast count: %+v\n", len(podcast.Items))
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user