mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
improve CLI error semantics and soundcloud canonicalization
Auto-upgrade outdated configs on startup, add actionable SSL verification hints in rip error paths, and harden SoundCloud search/metadata with canonical URL handling and richer source IDs.
This commit is contained in:
@@ -49,7 +49,7 @@ func Parse(raw string) *ParsedURL {
|
||||
return parseTidal(raw, parts)
|
||||
case isDeezerHost(host):
|
||||
return parseDeezer(raw, parts)
|
||||
case host == "soundcloud.com":
|
||||
case isSoundcloudHost(host):
|
||||
return parseSoundcloud(raw, parts)
|
||||
default:
|
||||
return nil
|
||||
@@ -129,7 +129,7 @@ func parseDeezer(raw string, parts []string) *ParsedURL {
|
||||
}
|
||||
|
||||
func parseSoundcloud(raw string, parts []string) *ParsedURL {
|
||||
if len(parts) < 2 {
|
||||
if len(parts) < 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -172,6 +172,10 @@ func isDeezerHost(host string) bool {
|
||||
return host == "deezer.com"
|
||||
}
|
||||
|
||||
func isSoundcloudHost(host string) bool {
|
||||
return host == "soundcloud.com" || strings.HasSuffix(host, ".soundcloud.com") || host == "on.soundcloud.com"
|
||||
}
|
||||
|
||||
func isSupportedMedia(mediaType string) bool {
|
||||
switch mediaType {
|
||||
case "album", "track", "playlist", "artist", "label", "video":
|
||||
|
||||
@@ -105,6 +105,8 @@ func TestSoundcloudURL(t *testing.T) {
|
||||
inputs := []string{
|
||||
"https://soundcloud.com/artist-name/track-name",
|
||||
"https://soundcloud.com/artist-name/sets/playlist-name",
|
||||
"https://m.soundcloud.com/artist-name/track-name",
|
||||
"https://on.soundcloud.com/abcdef",
|
||||
}
|
||||
for _, input := range inputs {
|
||||
result := Parse(input)
|
||||
|
||||
Reference in New Issue
Block a user