diff --git a/src/all/mangaplus/build.gradle b/src/all/mangaplus/build.gradle
index 7488b64ae..dbae9ce43 100644
--- a/src/all/mangaplus/build.gradle
+++ b/src/all/mangaplus/build.gradle
@@ -6,7 +6,7 @@ ext {
extName = 'MANGA Plus by SHUEISHA'
pkgNameSuffix = 'all.mangaplus'
extClass = '.MangaPlusFactory'
- extVersionCode = 20
+ extVersionCode = 21
libVersion = '1.2'
}
diff --git a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt
index a37e2fec1..632d3f78e 100644
--- a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt
+++ b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt
@@ -74,33 +74,6 @@ abstract class MangaPlus(
private var titleList: List
? = null
- /**
- * MANGA Plus recently started supporting other languages, but
- * they are not defined by the API. This is a temporary fix
- * to properly filter the titles while their API doesn't get an update.
- */
- private val titlesToFix: Map = mapOf(
- // Thai
- 100079 to Language.THAI,
- 100080 to Language.THAI,
- 100082 to Language.THAI,
- 100120 to Language.THAI,
- 100121 to Language.THAI,
- 100158 to Language.THAI,
-
- // Brazilian Portuguese
- 100149 to Language.PORTUGUESE_BR,
- 100150 to Language.PORTUGUESE_BR,
- 100151 to Language.PORTUGUESE_BR,
- 100163 to Language.PORTUGUESE_BR,
-
- // Indonesian
- 100140 to Language.INDONESIAN,
- 100142 to Language.INDONESIAN,
- 100143 to Language.INDONESIAN,
- 100162 to Language.INDONESIAN
- )
-
override fun popularMangaRequest(page: Int): Request {
val newHeaders = headersBuilder()
.set("Referer", "$baseUrl/manga_list/hot")
@@ -116,7 +89,6 @@ abstract class MangaPlus(
throw Exception(result.error!!.langPopup.body)
titleList = result.success.titleRankingView!!.titles
- .fixWrongLanguages()
.filter { it.language == langCode }
val mangas = titleList!!.map {
@@ -135,7 +107,7 @@ abstract class MangaPlus(
.set("Referer", "$baseUrl/updates")
.build()
- return GET("$API_URL/web/web_home?lang=$internalLang", newHeaders)
+ return GET("$API_URL/web/web_homeV3?lang=$internalLang", newHeaders)
}
override fun latestUpdatesParse(response: Response): MangasPage {
@@ -149,14 +121,13 @@ abstract class MangaPlus(
if (popularResponse.success != null) {
titleList = popularResponse.success.titleRankingView!!.titles
- .fixWrongLanguages()
.filter { it.language == langCode }
}
- val mangas = result.success.webHomeView!!.groups
+ val mangas = result.success.webHomeViewV3!!.groups
+ .flatMap { it.titleGroups }
.flatMap { it.titles }
- .mapNotNull { it.title }
- .fixWrongLanguages()
+ .map { it.title }
.filter { it.language == langCode }
.map {
SManga.create().apply {
@@ -191,7 +162,7 @@ abstract class MangaPlus(
.set("Referer", "$baseUrl/manga_list/all")
.build()
- return GET("$API_URL/title_list/all", newHeaders)
+ return GET("$API_URL/title_list/allV2", newHeaders)
}
override fun searchMangaParse(response: Response): MangasPage {
@@ -201,10 +172,7 @@ abstract class MangaPlus(
throw Exception(result.error!!.langPopup.body)
if (result.success.titleDetailView != null) {
- val mangaPlusTitle = result.success.titleDetailView.title.let {
- val correctLanguage = titlesToFix[it.titleId]
- if (correctLanguage != null) it.copy(language = correctLanguage) else it
- }
+ val mangaPlusTitle = result.success.titleDetailView.title
if (mangaPlusTitle.language == langCode) {
val manga = SManga.create().apply {
@@ -219,8 +187,8 @@ abstract class MangaPlus(
return MangasPage(emptyList(), hasNextPage = false)
}
- titleList = result.success.allTitlesView!!.titles
- .fixWrongLanguages()
+ titleList = result.success.allTitlesViewV2!!.allTitlesGroup
+ .flatMap { it.titles }
.filter { it.language == langCode }
val mangas = titleList!!.map {
@@ -448,11 +416,6 @@ abstract class MangaPlus(
return response
}
- private fun List.fixWrongLanguages(): List = map { title ->
- val correctLanguage = titlesToFix[title.titleId]
- if (correctLanguage != null) title.copy(language = correctLanguage) else title
- }
-
private val ErrorResult.langPopup: Popup
get() = when (internalLang) {
"esp" -> spanishPopup
diff --git a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt
index 8d929f329..8b8512e96 100644
--- a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt
+++ b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt
@@ -28,21 +28,29 @@ data class Popup(
@Serializable
data class SuccessResult(
@ProtoNumber(1) val isFeaturedUpdated: Boolean? = false,
- @ProtoNumber(5) val allTitlesView: AllTitlesView? = null,
@ProtoNumber(6) val titleRankingView: TitleRankingView? = null,
@ProtoNumber(8) val titleDetailView: TitleDetailView? = null,
@ProtoNumber(10) val mangaViewer: MangaViewer? = null,
- @ProtoNumber(11) val webHomeView: WebHomeView? = null
+ @ProtoNumber(25) val allTitlesViewV2: AllTitlesViewV2? = null,
+ @ProtoNumber(31) val webHomeViewV3: WebHomeViewV3? = null
)
@Serializable
data class TitleRankingView(@ProtoNumber(1) val titles: List = emptyList())
@Serializable
-data class AllTitlesView(@ProtoNumber(1) val titles: List = emptyList())
+data class AllTitlesViewV2(
+ @ProtoNumber(1) val allTitlesGroup: List = emptyList()
+)
@Serializable
-data class WebHomeView(@ProtoNumber(2) val groups: List = emptyList())
+data class AllTitlesGroup(
+ @ProtoNumber(1) val theTitle: String,
+ @ProtoNumber(2) val titles: List = emptyList()
+)
+
+@Serializable
+data class WebHomeViewV3(@ProtoNumber(2) val groups: List = emptyList())
@Serializable
data class TitleDetailView(
@@ -86,31 +94,42 @@ enum class Language(val id: Int) {
@SerializedName("1")
SPANISH(1),
- // Temporary add the languages that are not present on the API yet.
- // @ProtoNumber(2)
- // @SerializedName("2")
- THAI(2),
+ @ProtoNumber(2)
+ @SerializedName("2")
+ FRENCH(2),
- // @ProtoNumber(3)
- // @SerializedName("3")
- PORTUGUESE_BR(3),
+ @ProtoNumber(3)
+ @SerializedName("3")
+ INDONESIAN(4),
- // @ProtoNumber(4)
- // @SerializedName("4")
- INDONESIAN(4)
+ @ProtoNumber(4)
+ @SerializedName("4")
+ PORTUGUESE_BR(4),
+
+ @ProtoNumber(5)
+ @SerializedName("5")
+ RUSSIAN(5),
+
+ @ProtoNumber(6)
+ @SerializedName("6")
+ THAI(6)
}
@Serializable
-data class UpdatedTitleGroup(
+data class UpdatedTitleV2Group(
@ProtoNumber(1) val groupName: String,
- @ProtoNumber(2) val titles: List = emptyList()
+ @ProtoNumber(2) val titleGroups: List = emptyList()
)
@Serializable
-data class UpdatedTitle(
- @ProtoNumber(1) val title: Title? = null
+data class OriginalTitleGroup(
+ @ProtoNumber(1) val theTitle: String,
+ @ProtoNumber(3) val titles: List = emptyList()
)
+@Serializable
+data class UpdatedTitle(@ProtoNumber(1) val title: Title)
+
@Serializable
data class Chapter(
@ProtoNumber(1) val titleId: Int,
@@ -169,21 +188,25 @@ const val DECODE_SCRIPT: String =
.add(new Field("isFeaturedUpdated", 1, "bool"))
.add(
new OneOf("data")
- .add(new Field("allTitlesView", 5, "AllTitlesView"))
.add(new Field("titleRankingView", 6, "TitleRankingView"))
.add(new Field("titleDetailView", 8, "TitleDetailView"))
.add(new Field("mangaViewer", 10, "MangaViewer"))
- .add(new Field("webHomeView", 11, "WebHomeView"))
+ .add(new Field("allTitlesViewV2", 25, "AllTitlesViewV2"))
+ .add(new Field("webHomeViewV3", 31, "WebHomeViewV3"))
);
var TitleRankingView = new Type("TitleRankingView")
.add(new Field("titles", 1, "Title", "repeated"));
- var AllTitlesView = new Type("AllTitlesView")
- .add(new Field("titles", 1, "Title", "repeated"));
+ var AllTitlesViewV2 = new Type("AllTitlesViewV2")
+ .add(new Field("allTitlesGroup", 1, "AllTitlesGroup", "repeated"));
- var WebHomeView = new Type("WebHomeView")
- .add(new Field("groups", 2, "UpdatedTitleGroup", "repeated"));
+ var AlLTitlesGroup = new Type("AllTitlesGroup")
+ .add(new Field("theTitle", 1, "string"))
+ .add(new Field("titles", 2, "Title", "repeated"));
+
+ var WebHomeViewV3 = new Type("WebHomeViewV3")
+ .add(new Field("groups", 2, "UpdatedTitleV2Group", "repeated"));
var TitleDetailView = new Type("TitleDetailView")
.add(new Field("title", 1, "Title"))
@@ -224,13 +247,20 @@ const val DECODE_SCRIPT: String =
var Language = new Enum("Language")
.add("ENGLISH", 0)
- .add("SPANISH", 1);
- // .add("THAI", 2)
- // .add("PORTUGUESE_BR", 3);
+ .add("SPANISH", 1)
+ .add("FRENCH", 2)
+ .add("INDONESIAN", 3)
+ .add("PORTUGUESE_BR", 4)
+ .add("RUSSIAN", 5)
+ .add("THAI", 6);
- var UpdatedTitleGroup = new Type("UpdatedTitleGroup")
+ var UpdatedTitleV2Group = new Type("UpdatedTitleV2Group")
.add(new Field("groupName", 1, "string"))
- .add(new Field("titles", 2, "UpdatedTitle", "repeated"));
+ .add(new Field("titleGroups", 2, "OriginalTitleGroup", "repeated"));
+
+ var OriginalTitleGroup = new Type("OriginalTitleGroup")
+ .add(new Field("theTitle", 1, "string"))
+ .add(new Field("titles", 3, "UpdatedTitle", "repeated"));
var UpdatedTitle = new Type("UpdatedTitle")
.add(new Field("title", 1, "Title"))
@@ -263,14 +293,16 @@ const val DECODE_SCRIPT: String =
.add(Popup)
.add(SuccessResult)
.add(TitleRankingView)
- .add(AllTitlesView)
- .add(WebHomeView)
+ .add(AllTitlesViewV2)
+ .add(AllTitlesGroup)
+ .add(WebHomeViewV3)
.add(TitleDetailView)
.add(UpdateTiming)
.add(MangaViewer)
.add(Title)
.add(Language)
- .add(UpdatedTitleGroup)
+ .add(UpdatedTitleV2Group)
+ .add(OriginalTitleGroup)
.add(UpdatedTitle)
.add(Chapter)
.add(Page)
diff --git a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusFactory.kt b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusFactory.kt
index bb0f6b26b..4356da1c3 100644
--- a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusFactory.kt
+++ b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusFactory.kt
@@ -14,7 +14,7 @@ class MangaPlusFactory : SourceFactory {
}
class MangaPlusEnglish : MangaPlus("en", "eng", Language.ENGLISH)
-class MangaPlusIndonesian : MangaPlus("id", "eng", Language.INDONESIAN)
-class MangaPlusPortuguese : MangaPlus("pt-BR", "eng", Language.PORTUGUESE_BR)
+class MangaPlusIndonesian : MangaPlus("id", "ind", Language.INDONESIAN)
+class MangaPlusPortuguese : MangaPlus("pt-BR", "ptb", Language.PORTUGUESE_BR)
class MangaPlusSpanish : MangaPlus("es", "esp", Language.SPANISH)
-class MangaPlusThai : MangaPlus("th", "eng", Language.THAI)
+class MangaPlusThai : MangaPlus("th", "tha", Language.THAI)