LibreTube/app/src/main/java/com/github/libretube/extensions/ToID.kt

12 lines
271 B
Kotlin
Raw Normal View History

2022-08-27 18:43:24 +05:30
package com.github.libretube.extensions
2022-07-29 12:30:13 +05:30
/**
* format a Piped route to an ID
*/
2022-11-06 17:23:41 +05:30
fun String.toID(): String {
2022-09-08 23:31:36 +05:30
return this
2022-07-29 12:30:13 +05:30
.replace("/watch?v=", "") // videos
.replace("/channel/", "") // channels
.replace("/playlist?list=", "") // playlists
}