mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
some fix
- debug searchYoutube fun (2x)
This commit is contained in:
parent
bedd5406a0
commit
5dcbbdeb80
@ -40,12 +40,12 @@ fun searchYoutube(query: String): String? {
|
|||||||
|
|
||||||
val responseBody = response.body?.string()
|
val responseBody = response.body?.string()
|
||||||
val json = gson.fromJson(responseBody, JsonObject::class.java)
|
val json = gson.fromJson(responseBody, JsonObject::class.java)
|
||||||
val items = json.getAsJsonArray("items")
|
val items = json.getAsJsonArray("videos")
|
||||||
|
|
||||||
if (items.size() == 0) return null
|
if (items.size() == 0) return null
|
||||||
|
|
||||||
val firstItem = items[0].asJsonObject
|
val firstItem = items[0].asJsonObject
|
||||||
val videoUrl = firstItem.get("url").asString
|
val videoUrl = firstItem.get("link").asString
|
||||||
|
|
||||||
return videoUrl
|
return videoUrl
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user