|
|
|
@ -6,7 +6,9 @@ import kotlinx.coroutines.async
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
import kotlinx.coroutines.sync.Mutex
|
|
|
|
import kotlinx.coroutines.sync.Mutex
|
|
|
|
import kotlinx.coroutines.sync.withLock
|
|
|
|
import kotlinx.coroutines.sync.withLock
|
|
|
|
|
|
|
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
|
|
|
import org.jsoup.nodes.Document
|
|
|
|
import org.jsoup.nodes.Document
|
|
|
|
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
|
|
|
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
@ -43,9 +45,6 @@ internal abstract class WpComicsParser(
|
|
|
|
isSearchSupported = true,
|
|
|
|
isSearchSupported = true,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@JvmField
|
|
|
|
|
|
|
|
protected val coverSrcAttrs = arrayOf("data-original", "src")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
|
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
|
|
availableTags = fetchAvailableTags(),
|
|
|
|
availableTags = fetchAvailableTags(),
|
|
|
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
|
|
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
|
|
|
@ -164,7 +163,7 @@ internal abstract class WpComicsParser(
|
|
|
|
publicUrl = absUrl,
|
|
|
|
publicUrl = absUrl,
|
|
|
|
rating = RATING_UNKNOWN,
|
|
|
|
rating = RATING_UNKNOWN,
|
|
|
|
isNsfw = false,
|
|
|
|
isNsfw = false,
|
|
|
|
coverUrl = item.selectFirst("div.image a img")?.src(coverSrcAttrs).orEmpty(),
|
|
|
|
coverUrl = item.selectFirst("div.image a img")?.findImageUrl().orEmpty(),
|
|
|
|
largeCoverUrl = null,
|
|
|
|
largeCoverUrl = null,
|
|
|
|
tags = mangaTags,
|
|
|
|
tags = mangaTags,
|
|
|
|
state = mangaState,
|
|
|
|
state = mangaState,
|
|
|
|
@ -333,4 +332,12 @@ internal abstract class WpComicsParser(
|
|
|
|
else -> 0
|
|
|
|
else -> 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected fun Element.findImageUrl(): String? {
|
|
|
|
|
|
|
|
val attrs = attributes().filter { attr ->
|
|
|
|
|
|
|
|
attr.value.toHttpUrlOrNull() != null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// src attribute should have a lowest priority
|
|
|
|
|
|
|
|
return attrs.maxByOrNull { it.key != "src" }?.value
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|