harden qobuz and downloader reliability edge cases

This commit is contained in:
2026-04-21 18:54:10 +02:00
parent 0161c01a4c
commit de4e561377
8 changed files with 424 additions and 35 deletions

View File

@@ -146,7 +146,7 @@ func (c *Client) searchPlaylists(ctx context.Context, query string, limit int) (
return nil, err
}
re := regexp.MustCompile(`/[A-Za-z0-9_-]+/sets/[A-Za-z0-9_-]+`)
re := regexp.MustCompile(`/(?:[A-Za-z0-9._-]+)/sets/(?:[A-Za-z0-9._%~-]+)`)
paths := re.FindAllString(string(body), -1)
if len(paths) == 0 {
return []map[string]any{}, nil
@@ -435,10 +435,11 @@ func canonicalSoundcloudURL(info map[string]any) string {
continue
}
host := strings.ToLower(strings.TrimPrefix(u.Host, "www."))
if host != "soundcloud.com" {
if host != "soundcloud.com" && !strings.HasSuffix(host, ".soundcloud.com") {
continue
}
u.Scheme = "https"
u.Host = "soundcloud.com"
u.RawQuery = ""
u.Fragment = ""
u.Path = strings.TrimSuffix(u.Path, "/")