mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
fix: can't load music playlists using local extraction
This commit is contained in:
parent
87352f94c6
commit
8db2d34227
@ -1,13 +1,18 @@
|
|||||||
package com.github.libretube.extensions
|
package com.github.libretube.extensions
|
||||||
|
|
||||||
import com.github.libretube.ui.dialogs.ShareDialog.Companion.YOUTUBE_FRONTEND_URL
|
import com.github.libretube.ui.dialogs.ShareDialog.Companion.YOUTUBE_FRONTEND_URL
|
||||||
|
import com.github.libretube.ui.dialogs.ShareDialog.Companion.YOUTUBE_MUSIC_URL
|
||||||
|
import com.github.libretube.ui.dialogs.ShareDialog.Companion.YOUTUBE_SHORT_URL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* format a Piped route to an ID
|
* format a full YouTube url or a path to a video/channel/playlist ID
|
||||||
*/
|
*/
|
||||||
fun String.toID(): String {
|
fun String.toID(): String {
|
||||||
return this
|
return this
|
||||||
.replace(YOUTUBE_FRONTEND_URL, "")
|
// remove any youtube origins from urls
|
||||||
|
.removePrefix(YOUTUBE_FRONTEND_URL)
|
||||||
|
.removePrefix(YOUTUBE_MUSIC_URL)
|
||||||
|
.removePrefix(YOUTUBE_SHORT_URL)
|
||||||
.replace("/watch?v=", "") // videos
|
.replace("/watch?v=", "") // videos
|
||||||
.replace("/channel/", "") // channels
|
.replace("/channel/", "") // channels
|
||||||
.replace("/playlist?list=", "") // playlists
|
.replace("/playlist?list=", "") // playlists
|
||||||
|
@ -149,6 +149,7 @@ class ShareDialog : DialogFragment() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val YOUTUBE_FRONTEND_URL = "https://www.youtube.com"
|
const val YOUTUBE_FRONTEND_URL = "https://www.youtube.com"
|
||||||
|
const val YOUTUBE_MUSIC_URL = "https://music.youtube.com"
|
||||||
const val YOUTUBE_SHORT_URL = "https://youtu.be"
|
const val YOUTUBE_SHORT_URL = "https://youtu.be"
|
||||||
const val PIPED_FRONTEND_URL = "https://piped.video"
|
const val PIPED_FRONTEND_URL = "https://piped.video"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user