diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/rulib/MangaLibParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/rulib/MangaLibParser.kt index 9da969e2..1235748d 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/rulib/MangaLibParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/rulib/MangaLibParser.kt @@ -166,7 +166,7 @@ internal open class MangaLibParser( override suspend fun getPages(chapter: MangaChapter): List { val fullUrl = chapter.url.toAbsoluteUrl(getDomain()) val doc = context.httpGet(fullUrl).parseHtml() - if (doc.location().endsWith("/register")) { + if (doc.location().substringBefore('?').endsWith("/register")) { throw AuthRequiredException(source) } val scripts = doc.head().select("script") diff --git a/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt b/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt index f062d890..66333666 100644 --- a/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt +++ b/src/test/kotlin/org/koitharu/kotatsu/parsers/MangaParserTest.kt @@ -3,6 +3,7 @@ package org.koitharu.kotatsu.parsers import kotlinx.coroutines.test.runTest import okhttp3.HttpUrl import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.params.ParameterizedTest import org.koitharu.kotatsu.parsers.model.Manga @@ -10,10 +11,7 @@ import org.koitharu.kotatsu.parsers.model.MangaSource import org.koitharu.kotatsu.parsers.model.SortOrder import org.koitharu.kotatsu.parsers.util.medianOrNull import org.koitharu.kotatsu.parsers.util.mimeType -import org.koitharu.kotatsu.test_util.isDistinct -import org.koitharu.kotatsu.test_util.isDistinctBy -import org.koitharu.kotatsu.test_util.isUrlAbsolute -import org.koitharu.kotatsu.test_util.maxDuplicates +import org.koitharu.kotatsu.test_util.* @ExtendWith(AuthCheckExtension::class) @@ -21,6 +19,24 @@ internal class MangaParserTest { private val context = MangaLoaderContextMock() + @Test + fun singleTest() = runTest { + val manga = mangaOf(MangaSource.MANGALIB, "https://mangalib.me/dorohedoro") + val parser = manga.source.newParser(context) + val details = parser.getDetails(manga) + val chapter = details.chapters!!.first() + val pages = parser.getPages(chapter) + + assert(pages.isNotEmpty()) + assert(pages.isDistinctBy { it.id }) + + val page = pages.medianOrNull() ?: error("No page") + val pageUrl = parser.getPageUrl(page) + assert(pageUrl.isNotEmpty()) + assert(pageUrl.isUrlAbsolute()) + checkImageRequest(pageUrl, page.referer) + } + @ParameterizedTest(name = "{index}|list|{0}") @MangaSources fun list(source: MangaSource) = runTest {