|
|
|
@ -6,24 +6,27 @@ import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
import org.koitharu.kotatsu.parsers.model.Manga
|
|
|
|
import org.koitharu.kotatsu.parsers.model.Manga
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaChapter
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaState
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaState
|
|
|
|
import org.koitharu.kotatsu.parsers.model.RATING_UNKNOWN
|
|
|
|
import org.koitharu.kotatsu.parsers.model.RATING_UNKNOWN
|
|
|
|
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser
|
|
|
|
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
|
|
|
|
|
|
|
|
@MangaSourceParser("NETTRUYEN", "NetTruyen", "vi")
|
|
|
|
@MangaSourceParser("NETTRUYEN", "NetTruyen", "vi")
|
|
|
|
internal class NetTruyen(context: MangaLoaderContext) :
|
|
|
|
internal class NetTruyen(context: MangaLoaderContext) :
|
|
|
|
WpComicsParser(context, MangaParserSource.NETTRUYEN, "nettruyenrr.com", 44) {
|
|
|
|
WpComicsParser(context, MangaParserSource.NETTRUYEN, "nettruyenrr.com", 36) {
|
|
|
|
|
|
|
|
|
|
|
|
override val configKeyDomain: ConfigKey.Domain =
|
|
|
|
override val configKeyDomain: ConfigKey.Domain =
|
|
|
|
ConfigKey.Domain("nettruyenrr.com", "nettruyenww.com", "nettruyenx.com")
|
|
|
|
ConfigKey.Domain("nettruyenrr.com", "nettruyenww.com", "nettruyenx.com")
|
|
|
|
|
|
|
|
|
|
|
|
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
|
|
|
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
|
|
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
|
|
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
|
|
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
|
|
|
val docDeferred = async { webClient.httpGet(fullUrl).parseHtml() }
|
|
|
|
val chaptersDeferred = async { getChapters(doc, reversed = false) }
|
|
|
|
val chaptersDeferred = async { fetchChapters(manga.url) }
|
|
|
|
val tagMap = getOrCreateTagMap()
|
|
|
|
val tagMap = getOrCreateTagMap()
|
|
|
|
|
|
|
|
val doc = docDeferred.await()
|
|
|
|
val tagsElement = doc.select("li.kind p.col-xs-8 a")
|
|
|
|
val tagsElement = doc.select("li.kind p.col-xs-8 a")
|
|
|
|
val mangaTags = tagsElement.mapNotNullToSet { tagMap[it.text()] }
|
|
|
|
val mangaTags = tagsElement.mapNotNullToSet { tagMap[it.text()] }
|
|
|
|
manga.copy(
|
|
|
|
manga.copy(
|
|
|
|
@ -42,4 +45,30 @@ internal class NetTruyen(context: MangaLoaderContext) :
|
|
|
|
chapters = chaptersDeferred.await(),
|
|
|
|
chapters = chaptersDeferred.await(),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private suspend fun fetchChapters(mangaUrl: String): List<MangaChapter> {
|
|
|
|
|
|
|
|
val slug = mangaUrl.substringAfterLast('/').substringBeforeLast('-')
|
|
|
|
|
|
|
|
val id = mangaUrl.substringAfterLast('-')
|
|
|
|
|
|
|
|
val chaptersUrl = "/Comic/Services/ComicService.asmx/ChapterList?slug=$slug&comicId=$id".toAbsoluteUrl(domain)
|
|
|
|
|
|
|
|
val df = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val data = webClient.httpGet(chaptersUrl).parseJson().getJSONArray("data")
|
|
|
|
|
|
|
|
return List(data.length()) { i ->
|
|
|
|
|
|
|
|
val jo = data.getJSONObject(data.length() - 1 - i)
|
|
|
|
|
|
|
|
val chapterSlug = jo.getString("chapter_slug")
|
|
|
|
|
|
|
|
val chapterUrl = "/truyen-tranh/$slug/$chapterSlug"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MangaChapter(
|
|
|
|
|
|
|
|
id = generateUid(chapterUrl),
|
|
|
|
|
|
|
|
name = jo.getString("chapter_name"),
|
|
|
|
|
|
|
|
number = i + 1f,
|
|
|
|
|
|
|
|
volume = 0,
|
|
|
|
|
|
|
|
url = chapterUrl,
|
|
|
|
|
|
|
|
scanlator = null,
|
|
|
|
|
|
|
|
uploadDate = df.tryParse(jo.getString("updated_at")),
|
|
|
|
|
|
|
|
branch = null,
|
|
|
|
|
|
|
|
source = source,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|