Merge pull request #1413 from dragonx943/sources/manhwaindo
[Manhwaindo] Fix missing images
This commit is contained in:
@@ -4,10 +4,35 @@ import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|||||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
||||||
import org.koitharu.kotatsu.parsers.site.mangareader.MangaReaderParser
|
import org.koitharu.kotatsu.parsers.site.mangareader.MangaReaderParser
|
||||||
|
import org.koitharu.kotatsu.parsers.model.*
|
||||||
|
import org.koitharu.kotatsu.parsers.util.*
|
||||||
|
|
||||||
@MangaSourceParser("MANHWAINDO", "ManhwaIndo", "id")
|
@MangaSourceParser("MANHWAINDO", "ManhwaIndo", "id")
|
||||||
internal class ManhwaIndoParser(context: MangaLoaderContext) :
|
internal class ManhwaIndoParser(context: MangaLoaderContext) :
|
||||||
MangaReaderParser(context, MangaParserSource.MANHWAINDO, "manhwaindo.one", pageSize = 30, searchPageSize = 10) {
|
MangaReaderParser(context, MangaParserSource.MANHWAINDO, "manhwaindo.one", pageSize = 30, searchPageSize = 10) {
|
||||||
override val datePattern = "MMM d, yyyy"
|
override val datePattern = "MMM d, yyyy"
|
||||||
override val listUrl = "/series"
|
override val listUrl = "/series"
|
||||||
|
|
||||||
|
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||||
|
val chapterUrl = chapter.url.toAbsoluteUrl(domain)
|
||||||
|
val docs = webClient.httpGet(chapterUrl).parseHtml()
|
||||||
|
return docs.select(selectPage).mapNotNull { img ->
|
||||||
|
val url = img.attr("data-src").takeIf { it.isNotBlank() }?.toRelativeUrl(domain) ?: return@mapNotNull null
|
||||||
|
try {
|
||||||
|
val response = webClient.httpHead(url)
|
||||||
|
if (response.headers["Content-Type"]?.startsWith("image/") == true) {
|
||||||
|
MangaPage(
|
||||||
|
id = generateUid(url),
|
||||||
|
url = url,
|
||||||
|
preview = null,
|
||||||
|
source = source,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user