Support youtu.be links (#77)
This commit is contained in:
@@ -77,6 +77,12 @@ fun IntentUriScreen(uri: Uri) {
|
||||
YouTube.song(videoId)?.map { song ->
|
||||
song?.let { listOf(song) } ?: emptyList()
|
||||
}
|
||||
} ?: uri.takeIf {
|
||||
uri.host == "youtu.be"
|
||||
}?.path?.drop(1)?.let { videoId ->
|
||||
YouTube.song(videoId)?.map { song ->
|
||||
song?.let { listOf(song) } ?: emptyList()
|
||||
}
|
||||
} ?: Result.failure(Error("Missing URL parameters"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,13 @@ fun SearchScreen(
|
||||
val typography = LocalTypography.current
|
||||
|
||||
val isOpenableUrl = remember(textFieldValue.text) {
|
||||
Regex("""https://(music|www|m)\.youtube.com/(watch|playlist).*""").matches(textFieldValue.text)
|
||||
listOf(
|
||||
"https://www.youtube.com/watch?",
|
||||
"https://music.youtube.com/watch?",
|
||||
"https://www.youtube.com/list?",
|
||||
"https://music.youtube.com/list?",
|
||||
"https://youtu.be/",
|
||||
).any(textFieldValue.text::startsWith)
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
|
||||
Reference in New Issue
Block a user