[wpcomics/vi/nettruyen*] Fix fetch invaild format
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package org.koitharu.kotatsu.parsers.site.wpcomics.vi
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.jsoup.nodes.Element
|
||||
import androidx.collection.ArrayMap
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
@@ -134,14 +138,26 @@ internal class NetTruyenFE(context: MangaLoaderContext) :
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||
return doc.select(selectPage).map { url ->
|
||||
var img = url.attr("data-original").toRelativeUrl(domain)
|
||||
MangaPage(
|
||||
id = generateUid(img),
|
||||
url = img,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
return coroutineScope {
|
||||
doc.select(selectPage).map { img ->
|
||||
async { fetchPage(img) }
|
||||
}.awaitAll().filterNotNull()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun fetchPage(img: Element): MangaPage? = runCatchingCancellable {
|
||||
val url = img.attrAsRelativeUrlOrNull("data-original") ?: return@runCatchingCancellable null
|
||||
webClient.httpHead(url).use { response ->
|
||||
if (response.mimeType?.startsWith("image/") == true) {
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}.getOrNull()
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.koitharu.kotatsu.parsers.site.wpcomics.vi
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.jsoup.nodes.Element
|
||||
import androidx.collection.ArrayMap
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
@@ -134,14 +138,26 @@ internal class NetTruyenLL(context: MangaLoaderContext) :
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||
return doc.select(selectPage).map { url ->
|
||||
var img = url.attr("data-original").toRelativeUrl(domain)
|
||||
MangaPage(
|
||||
id = generateUid(img),
|
||||
url = img,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
return coroutineScope {
|
||||
doc.select(selectPage).map { img ->
|
||||
async { fetchPage(img) }
|
||||
}.awaitAll().filterNotNull()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun fetchPage(img: Element): MangaPage? = runCatchingCancellable {
|
||||
val url = img.attrAsRelativeUrlOrNull("data-original") ?: return@runCatchingCancellable null
|
||||
webClient.httpHead(url).use { response ->
|
||||
if (response.mimeType?.startsWith("image/") == true) {
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}.getOrNull()
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.koitharu.kotatsu.parsers.site.wpcomics.vi
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.jsoup.nodes.Element
|
||||
import androidx.collection.ArrayMap
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
@@ -134,14 +138,26 @@ internal class NetTruyenSSR(context: MangaLoaderContext) :
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||
return doc.select(selectPage).map { url ->
|
||||
var img = url.attr("data-original").toRelativeUrl(domain)
|
||||
MangaPage(
|
||||
id = generateUid(img),
|
||||
url = img,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
return coroutineScope {
|
||||
doc.select(selectPage).map { img ->
|
||||
async { fetchPage(img) }
|
||||
}.awaitAll().filterNotNull()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun fetchPage(img: Element): MangaPage? = runCatchingCancellable {
|
||||
val url = img.attrAsRelativeUrlOrNull("data-original") ?: return@runCatchingCancellable null
|
||||
webClient.httpHead(url).use { response ->
|
||||
if (response.mimeType?.startsWith("image/") == true) {
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}.getOrNull()
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.koitharu.kotatsu.parsers.site.wpcomics.vi
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.jsoup.nodes.Element
|
||||
import androidx.collection.ArrayMap
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
@@ -134,14 +138,26 @@ internal class NetTruyenUU(context: MangaLoaderContext) :
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||
return doc.select(selectPage).map { url ->
|
||||
var img = url.attr("data-original").toRelativeUrl(domain)
|
||||
MangaPage(
|
||||
id = generateUid(img),
|
||||
url = img,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
return coroutineScope {
|
||||
doc.select(selectPage).map { img ->
|
||||
async { fetchPage(img) }
|
||||
}.awaitAll().filterNotNull()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun fetchPage(img: Element): MangaPage? = runCatchingCancellable {
|
||||
val url = img.attrAsRelativeUrlOrNull("data-original") ?: return@runCatchingCancellable null
|
||||
webClient.httpHead(url).use { response ->
|
||||
if (response.mimeType?.startsWith("image/") == true) {
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}.getOrNull()
|
||||
}
|
||||
Reference in New Issue
Block a user