Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: YT sanitizer should clean YT music domains #380

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ class YoutubeSanitizer :
name = context.getString(R.string.sanitizer_youtube_name),
)

override fun matchesDomain(input: String) = input.matchesDomainRegex("(m\\.)?youtube\\.com")
override fun matchesDomain(input: String) =
input.matchesDomainRegex("(?:m(?:usic)?\\.)?youtube\\.com")
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class YoutubeSanitizerTest :
) shouldBe
"https://youtube.com/playlist?list=PLkqz3S84Tw-QYEdfTLBzxJ1FAprtqeEpJ"
}

"remove all parameters except \"v\" from YouTube Music URLs" {
sanitizer(
"https://music.youtube.com/watch?v=KGFkMD2zotU&si=JrZ7QzX4VeMrfzp8",
) shouldBe
"https://music.youtube.com/watch?v=KGFkMD2zotU"
}
}

"matchesDomain" should {
Expand All @@ -57,6 +64,10 @@ class YoutubeSanitizerTest :
"match m.youtube.com domain" {
sanitizer.matchesDomain("https://m.youtube.com/") shouldBe true
}

"match music.youtube.com domain" {
sanitizer.matchesDomain("https://music.youtube.com/") shouldBe true
}
}
},
)