mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
some fix
- debug searchYoutube fun (7x)
This commit is contained in:
parent
76ffebc157
commit
833bfbd46d
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user