-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1331 from dragonx943/final
Update domain + Fixes
- Loading branch information
Showing
19 changed files
with
131 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
total: 1173 | ||
total: 1174 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/main/kotlin/org/koitharu/kotatsu/parsers/site/wpcomics/vi/MeHentaiVN.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package org.koitharu.kotatsu.parsers.site.wpcomics.vi | ||
|
||
import kotlinx.coroutines.async | ||
import androidx.collection.ArraySet | ||
import kotlinx.coroutines.coroutineScope | ||
import org.koitharu.kotatsu.parsers.MangaLoaderContext | ||
import org.koitharu.kotatsu.parsers.MangaSourceParser | ||
import org.koitharu.kotatsu.parsers.config.ConfigKey | ||
import org.koitharu.kotatsu.parsers.model.MangaParserSource | ||
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser | ||
import org.koitharu.kotatsu.parsers.model.* | ||
import org.koitharu.kotatsu.parsers.util.* | ||
import java.util.* | ||
|
||
@MangaSourceParser("MEHENTAIVN", "MeHentaiVN", "vi", ContentType.HENTAI) | ||
internal class MeHentaiVN(context: MangaLoaderContext) : | ||
WpComicsParser(context, MangaParserSource.MEHENTAIVN, "www.mehentaivn.xyz", 44) { | ||
|
||
override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("www.mehentaivn.xyz", "www.hentaivnx.autos") | ||
|
||
override suspend fun getFilterOptions() = MangaListFilterOptions( | ||
availableTags = fetchTags(), | ||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED), | ||
) | ||
|
||
override suspend fun getDetails(manga: Manga): Manga = coroutineScope { | ||
val fullUrl = manga.url.toAbsoluteUrl(domain) | ||
val doc = webClient.httpGet(fullUrl).parseHtml() | ||
val chaptersDeferred = async { getChapters(doc) } | ||
val tagMap = getOrCreateTagMap() | ||
val tagsElement = doc.select("li.kind p.col-xs-8 a") | ||
val mangaTags = tagsElement.mapNotNullToSet { | ||
val tagTitle = it.text() | ||
if (tagTitle.isNotEmpty()) | ||
MangaTag( | ||
title = tagTitle, | ||
key = tagsElement.attr("href").substringAfterLast('/').trim(), | ||
source = source | ||
) | ||
else null | ||
} | ||
|
||
manga.copy( | ||
description = doc.selectFirst(selectDesc)?.html().orEmpty(), | ||
altTitle = doc.selectFirst("h2.other-name")?.text().orEmpty(), | ||
author = doc.body().select(selectAut).text(), | ||
state = doc.selectFirst(selectState)?.let { | ||
when (it.text()) { | ||
in ongoing -> MangaState.ONGOING | ||
in finished -> MangaState.FINISHED | ||
else -> null | ||
} | ||
}, | ||
tags = mangaTags, | ||
rating = doc.selectFirst("div.star input")?.attr("value")?.toFloatOrNull()?.div(5f) ?: RATING_UNKNOWN, | ||
chapters = chaptersDeferred.await(), | ||
isNsfw = true | ||
) | ||
} | ||
|
||
private suspend fun fetchTags(): Set<MangaTag> { | ||
val doc = webClient.httpGet("https://$domain/").parseHtml() | ||
val tagItems = doc.select("ul.dropdown-menu.megamenu li a") | ||
val tagSet = ArraySet<MangaTag>(tagItems.size) | ||
for (item in tagItems) { | ||
val title = item.attr("data-title").trim() | ||
val key = item.attr("href").substringAfterLast('/').trim() | ||
if (key.isNotEmpty() && title.isNotEmpty()) { | ||
tagSet.add(MangaTag(title = title, key = key, source = source)) | ||
} | ||
} | ||
return tagSet | ||
} | ||
} |
42 changes: 39 additions & 3 deletions
42
src/main/kotlin/org/koitharu/kotatsu/parsers/site/wpcomics/vi/NetTruyen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,51 @@ | ||
package org.koitharu.kotatsu.parsers.site.wpcomics.vi | ||
|
||
import androidx.collection.ArrayMap | ||
import androidx.collection.ArraySet | ||
import kotlinx.coroutines.async | ||
import kotlinx.coroutines.coroutineScope | ||
import kotlinx.coroutines.sync.Mutex | ||
import kotlinx.coroutines.sync.withLock | ||
import org.jsoup.nodes.Document | ||
import org.jsoup.nodes.Element | ||
import org.koitharu.kotatsu.parsers.MangaLoaderContext | ||
import org.koitharu.kotatsu.parsers.MangaSourceParser | ||
import org.koitharu.kotatsu.parsers.config.ConfigKey | ||
import org.koitharu.kotatsu.parsers.model.MangaParserSource | ||
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser | ||
import org.koitharu.kotatsu.parsers.model.* | ||
import org.koitharu.kotatsu.parsers.util.* | ||
import java.text.DateFormat | ||
import java.text.SimpleDateFormat | ||
import java.util.* | ||
|
||
@MangaSourceParser("NETTRUYEN", "NetTruyen", "vi") | ||
internal class NetTruyen(context: MangaLoaderContext) : | ||
WpComicsParser(context, MangaParserSource.NETTRUYEN, "nettruyenww.com", 44) { | ||
override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain( | ||
"nettruyenww.com", "nettruyenx.com", | ||
) | ||
|
||
override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("nettruyenww.com", "nettruyenx.com") | ||
|
||
override suspend fun getDetails(manga: Manga): Manga = coroutineScope { | ||
val fullUrl = manga.url.toAbsoluteUrl(domain) | ||
val doc = webClient.httpGet(fullUrl).parseHtml() | ||
val chaptersDeferred = async { getChapters(doc) } | ||
val tagMap = getOrCreateTagMap() | ||
val tagsElement = doc.select("li.kind p.col-xs-8 a") | ||
val mangaTags = tagsElement.mapNotNullToSet { tagMap[it.text()] } | ||
manga.copy( | ||
description = doc.selectFirst(selectDesc)?.html().orEmpty(), | ||
altTitle = doc.selectFirst("h2.other-name")?.text().orEmpty(), | ||
author = doc.body().select(selectAut).text(), | ||
state = doc.selectFirst(selectState)?.let { | ||
when (it.text()) { | ||
in ongoing -> MangaState.ONGOING | ||
in finished -> MangaState.FINISHED | ||
else -> null | ||
} | ||
}, | ||
tags = mangaTags, | ||
rating = doc.selectFirst("div.star input")?.attr("value")?.toFloatOrNull()?.div(5f) ?: RATING_UNKNOWN, | ||
chapters = chaptersDeferred.await().reversed(), | ||
) | ||
} | ||
} |