mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 12:51:13 +00:00
some fix
- debug searchYoutube fun (7x)
This commit is contained in:
@@ -42,16 +42,20 @@ fun searchYoutube(query: String): String? {
|
||||
|
||||
logger.info(firstVideo.toString())
|
||||
|
||||
val videoUrl = firstVideo.get("link").asString
|
||||
val videoId = firstVideo.get("id").asString
|
||||
|
||||
return videoUrl
|
||||
return videoId
|
||||
}
|
||||
}
|
||||
|
||||
fun getYoutubeVideoId(query: String): String? {
|
||||
val matchResult = regex.find(query)
|
||||
|
||||
return matchResult?.groups?.get(1)?.value ?: searchYoutube(query)
|
||||
return if(matchResult == null) {
|
||||
searchYoutube(query)
|
||||
} else {
|
||||
matchResult.groups[1]?.value
|
||||
}
|
||||
}
|
||||
|
||||
fun parseDuration(duration: String): Int {
|
||||
|
Reference in New Issue
Block a user