diff --git a/internal/sponsorblock/query.go b/internal/sponsorblock/query.go index fd204f7..ae7e203 100644 --- a/internal/sponsorblock/query.go +++ b/internal/sponsorblock/query.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "io" + "log/slog" "net/http" "net/url" "path" @@ -54,6 +55,7 @@ func QuerySegments(ctx context.Context, id string) ([]Segment, error) { u.Path = path.Join("api", "skipSegments", checksum[:4]) u.RawQuery = query.Encode() + slog.Debug("Request segments", "url", u.String()) req, err := http.NewRequest(http.MethodGet, u.String(), nil) if err != nil { return nil, err diff --git a/internal/youtube/youtube.go b/internal/youtube/youtube.go index 4ff55ec..bb5c006 100644 --- a/internal/youtube/youtube.go +++ b/internal/youtube/youtube.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "github.com/gabe565/castsponsorskip/internal/config" "google.golang.org/api/option" @@ -29,8 +30,10 @@ func QueryVideoId(ctx context.Context, artist, title string) (string, error) { return "", ErrNotConnected } + query := fmt.Sprintf(`%q+intitle:%q`, artist, title) + slog.Debug("Searching for video ID", "query", query) response, err := service.Search.List([]string{"id"}). - Q(fmt.Sprintf(`%q+intitle:%q`, artist, title)). + Q(query). MaxResults(1). Context(ctx). Do()