keiyoushi / extensions-source

Source code of extensions for Tachiyomi/Mihon and variants.
https://keiyoushi.github.io/
Apache License 2.0
2.17k stars 483 forks source link

K Manga (Kodansha) #2358

Open lalalasupa0 opened 7 months ago

lalalasupa0 commented 7 months ago

Source name

K Manga

Source link

https://kmanga.kodansha.com/

Source language

English

Other details

No response

Acknowledgements

rexamidalion commented 4 months ago

I'm interested in this site too!! Also, a few notes; as the label says, it's geo locked to the US but a vpn works to circumvent it. It also has a points system for viewing manga which is annoying..

vetleledaal commented 2 months ago

Ran across this script, which might be useful: https://greasyfork.org/en/scripts/467901-k-manga-ripper

Assuming that script is correct, the equivalent descrambling function getUnscrambledCoords() would be:

class Coord(val x: Int, val y: Int)
class CoordPair(val source: Coord, val dest: Coord)

private fun xorshift32(seed: UInt) =
    seed.let { it xor (it shl 13) }
        .let { it xor (it shr 17) }
        .let { it xor (it shl 5) }

private fun getUnscrambledCoords(seed: Int): List<CoordPair> {
    var seed32 = seed.toUInt()
    val pairs = mutableListOf<Pair<UInt, Int>>()

    for (i in 0 until 16) {
        seed32 = xorshift32(seed32)
        pairs.add(seed32 to i)
    }

    pairs.sortBy { it.first }
    val sortedVal = pairs.map { it.second }

    return sortedVal.mapIndexed { i, e ->
        CoordPair(
            source = Coord(x = e % 4, y = e / 4),
            dest = Coord(x = i % 4, y = i / 4),
        )
    }
}