Pupil-84 Title doesn't show up when using hiyobi

This commit is contained in:
tom5079
2020-06-20 15:28:01 +09:00
parent e6b7c107f2
commit 5bc4610061
4 changed files with 50 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ package xyz.quaver.hiyobi
import kotlinx.serialization.UnstableDefault
import kotlinx.serialization.builtins.list
import org.jsoup.Jsoup
import kotlinx.serialization.json.contentOrNull
import xyz.quaver.Code
import xyz.quaver.hitomi.GalleryFiles
import xyz.quaver.hitomi.GalleryInfo
@@ -64,14 +64,23 @@ fun renewCookie() : String {
@OptIn(UnstableDefault::class)
fun getReader(galleryID: Int) : Reader {
val reader = "https://$hiyobi/reader/$galleryID"
val url = "https://cdn.hiyobi.me/data/json/${galleryID}_list.json"
val data = "https://cdn.$hiyobi/data/json/$galleryID.json"
val list = "https://cdn.$hiyobi/data/json/${galleryID}_list.json"
val title = Jsoup.connect(reader).proxy(proxy).get().title()
val title = with(URL(data).openConnection(proxy) as HttpsURLConnection) {
setRequestProperty("User-Agent", user_agent)
setRequestProperty("Cookie", cookie)
connectTimeout = 1000
connect()
inputStream.bufferedReader().use { it.readText() }
}.let {
json.parseJson(it).jsonObject["n"]?.contentOrNull
}
val galleryFiles = json.parse(
GalleryFiles.serializer().list,
with(URL(url).openConnection(proxy) as HttpsURLConnection) {
with(URL(list).openConnection(proxy) as HttpsURLConnection) {
setRequestProperty("User-Agent", user_agent)
setRequestProperty("Cookie", cookie)
connectTimeout = 1000