diff --git a/src/en/nyraxmanga/build.gradle b/src/en/nyraxmanga/build.gradle new file mode 100644 index 000000000..efa219080 --- /dev/null +++ b/src/en/nyraxmanga/build.gradle @@ -0,0 +1,10 @@ +ext { + extName = 'Nyrax Manga' + extClass = '.NyraxManga' + themePkg = 'mangathemesia' + baseUrl = 'https://nyraxmanga.com' + overrideVersionCode = 0 + isNsfw = false +} + +apply from: "$rootDir/common.gradle" diff --git a/src/en/nyraxmanga/res/mipmap-hdpi/ic_launcher.png b/src/en/nyraxmanga/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..c2711cf9d Binary files /dev/null and b/src/en/nyraxmanga/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/en/nyraxmanga/res/mipmap-mdpi/ic_launcher.png b/src/en/nyraxmanga/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..e18a23546 Binary files /dev/null and b/src/en/nyraxmanga/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/en/nyraxmanga/res/mipmap-xhdpi/ic_launcher.png b/src/en/nyraxmanga/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..67ce56aee Binary files /dev/null and b/src/en/nyraxmanga/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/en/nyraxmanga/res/mipmap-xxhdpi/ic_launcher.png b/src/en/nyraxmanga/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..99596f01f Binary files /dev/null and b/src/en/nyraxmanga/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/en/nyraxmanga/res/mipmap-xxxhdpi/ic_launcher.png b/src/en/nyraxmanga/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..cc04589f1 Binary files /dev/null and b/src/en/nyraxmanga/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/en/nyraxmanga/src/eu/kanade/tachiyomi/extension/en/nyraxmanga/NyraxManga.kt b/src/en/nyraxmanga/src/eu/kanade/tachiyomi/extension/en/nyraxmanga/NyraxManga.kt new file mode 100644 index 000000000..a6d4aedce --- /dev/null +++ b/src/en/nyraxmanga/src/eu/kanade/tachiyomi/extension/en/nyraxmanga/NyraxManga.kt @@ -0,0 +1,42 @@ +package eu.kanade.tachiyomi.extension.en.nyraxmanga + +import android.util.Base64 +import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia +import eu.kanade.tachiyomi.source.model.Page +import eu.kanade.tachiyomi.source.model.SManga +import kotlinx.serialization.json.jsonArray +import kotlinx.serialization.json.jsonPrimitive +import org.jsoup.nodes.Document +import java.lang.IllegalArgumentException + +class NyraxManga : MangaThemesia( + "Nyrax Manga", + "https://nyraxmanga.com", + "en", +) { + override fun mangaDetailsParse(document: Document): SManga { + return super.mangaDetailsParse(document).apply { + // Add 'color' badge as a genre + if (document.selectFirst(".thumb .colored") != null) { + genre = genre?.plus(", Color") + } + } + } + + override fun pageListParse(document: Document): List { + // "ts_reader.run({" in base64 + val script = document.selectFirst("script[src^=data:text/javascript;base64,dHNfcmVhZGVyLnJ1bih7]") + ?: return super.pageListParse(document) + val data = Base64.decode(script.attr("src").substringAfter("base64,"), Base64.DEFAULT).toString(Charsets.UTF_8) + val imageListJson = JSON_IMAGE_LIST_REGEX.find(data)?.destructured?.toList()?.get(0).orEmpty() + val imageList = try { + json.parseToJsonElement(imageListJson).jsonArray + } catch (_: IllegalArgumentException) { + emptyList() + } + + return imageList.mapIndexed { i, jsonEl -> + Page(i, document.location(), jsonEl.jsonPrimitive.content) + } + } +}