diff --git a/libpupil/src/main/java/xyz/quaver/hiyobi/galleryblock.kt b/libpupil/src/main/java/xyz/quaver/hiyobi/galleryblock.kt index 1529dbad..756ae243 100644 --- a/libpupil/src/main/java/xyz/quaver/hiyobi/galleryblock.kt +++ b/libpupil/src/main/java/xyz/quaver/hiyobi/galleryblock.kt @@ -22,28 +22,24 @@ import xyz.quaver.hitomi.GalleryBlock import xyz.quaver.hitomi.protocol fun getGalleryBlock(galleryID: Int) : GalleryBlock? { - val url = "$protocol//$hiyobi/search/$galleryID" + val url = "$protocol//$hiyobi/info/$galleryID" - try { - val doc = Jsoup.connect(url).get() + val doc = Jsoup.connect(url).get() - val galleryBlock = doc.selectFirst(".gallery-content") + val galleryBlock = doc.selectFirst(".gallery-content") - val galleryUrl = galleryBlock.selectFirst("a").attr("href") + val galleryUrl = galleryBlock.selectFirst("a").attr("href") - val thumbnails = listOf(galleryBlock.selectFirst("img").attr("abs:src")) + val thumbnails = listOf(galleryBlock.selectFirst("img").attr("abs:src")) - val title = galleryBlock.selectFirst("b").text() - val artists = galleryBlock.select("tr:matches(작가) a[href~=artist]").map { it.text() } - val series = galleryBlock.select("tr:matches(원작) a").map { it.attr("href").substringAfter("series:").replace('_', ' ') } - val type = galleryBlock.selectFirst("tr:matches(종류) a").attr("href").substringAfter("type:").replace('_', ' ') + val title = galleryBlock.selectFirst("b").text() + val artists = galleryBlock.select("tr:matches(작가) a[href~=artist]").map { it.text() } + val series = galleryBlock.select("tr:matches(원작) a").map { it.attr("href").substringAfter("series:").replace('_', ' ') } + val type = galleryBlock.selectFirst("tr:matches(종류) a").attr("href").substringAfter("type:").replace('_', ' ') - val language = "korean" + val language = "korean" - val relatedTags = galleryBlock.select("tr:matches(태그) a").map { it.attr("href").substringAfterLast('/').replace('_', ' ') } + val relatedTags = galleryBlock.select("tr:matches(태그) a").map { it.attr("href").substringAfterLast('/').replace('_', ' ') } - return GalleryBlock(Code.HIYOBI, galleryID, galleryUrl, thumbnails, title, artists, series, type, language, relatedTags) - } catch (e: Exception) { - return null - } + return GalleryBlock(Code.HIYOBI, galleryID, galleryUrl, thumbnails, title, artists, series, type, language, relatedTags) } \ No newline at end of file