Add Nyrax Manga (#3971)

* Add Nyrax Manga

* Set page url for Referer, actually set isNsfw

Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>

---------

Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
Vetle Ledaal 2024-07-13 08:10:34 +02:00 committed by Draff
parent 39475d8916
commit 3862f49ad7
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
7 changed files with 52 additions and 0 deletions

View File

@ -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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -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<Page> {
// "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)
}
}
}