diff --git a/src/ja/rawinu/build.gradle b/src/ja/rawinu/build.gradle new file mode 100644 index 000000000..18dde0550 --- /dev/null +++ b/src/ja/rawinu/build.gradle @@ -0,0 +1,10 @@ +ext { + extName = 'RawINU' + extClass = '.RawINU' + themePkg = 'fmreader' + baseUrl = 'https://rawinu.com' + overrideVersionCode = 0 + isNsfw = true +} + +apply from: "$rootDir/common.gradle" diff --git a/src/ja/rawinu/res/mipmap-hdpi/ic_launcher.png b/src/ja/rawinu/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..d4f5b238d Binary files /dev/null and b/src/ja/rawinu/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/ja/rawinu/res/mipmap-mdpi/ic_launcher.png b/src/ja/rawinu/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..af44ba12c Binary files /dev/null and b/src/ja/rawinu/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/ja/rawinu/res/mipmap-xhdpi/ic_launcher.png b/src/ja/rawinu/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..3e69d48b6 Binary files /dev/null and b/src/ja/rawinu/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/ja/rawinu/res/mipmap-xxhdpi/ic_launcher.png b/src/ja/rawinu/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..df77251b9 Binary files /dev/null and b/src/ja/rawinu/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/ja/rawinu/res/mipmap-xxxhdpi/ic_launcher.png b/src/ja/rawinu/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..b71e5eeca Binary files /dev/null and b/src/ja/rawinu/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/ja/rawinu/src/eu/kanade/tachiyomi/extension/ja/rawinu/RawINU.kt b/src/ja/rawinu/src/eu/kanade/tachiyomi/extension/ja/rawinu/RawINU.kt new file mode 100644 index 000000000..c3c9b4a40 --- /dev/null +++ b/src/ja/rawinu/src/eu/kanade/tachiyomi/extension/ja/rawinu/RawINU.kt @@ -0,0 +1,57 @@ +package eu.kanade.tachiyomi.extension.ja.rawinu + +import eu.kanade.tachiyomi.multisrc.fmreader.FMReader +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost +import eu.kanade.tachiyomi.source.model.Page +import eu.kanade.tachiyomi.source.model.SChapter +import eu.kanade.tachiyomi.source.model.SManga +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element + +class RawINU : FMReader( + "RawINU", + "https://rawinu.com", + "ja", +) { + override val client = network.client.newBuilder() + .rateLimitHost(baseUrl.toHttpUrl(), 2) + .build() + + private val apiEndpoint = "$baseUrl/app/manga/controllers" + + // =========================== Manga Details ============================ + override val infoElementSelector = "div.card-body div.row" + + // ============================== Chapters ============================== + override fun chapterListRequest(manga: SManga): Request { + val slug = manga.url.substringAfter("/manga-").substringBefore(".html") + return GET("$apiEndpoint/cont.Listchapter.php?slug=$slug", headers) + } + + override fun chapterListParse(response: Response): List { + val doc = response.asJsoup() + doc.setBaseUri(baseUrl) // Fixes chapter URLs + return doc.select(chapterListSelector()).map(::chapterFromElement) + } + + override fun chapterFromElement(element: Element) = SChapter.create().apply { + setUrlWithoutDomain(element.absUrl("href")) + name = element.attr(chapterNameAttrSelector).trim() + date_upload = element.select(chapterTimeSelector).run { if (hasText()) parseRelativeDate(text()) else 0 } + } + + // =============================== Pages ================================ + override fun pageListParse(document: Document): List { + val id = document.selectFirst("input[name=chapter]#chapter")!!.attr("value") + val req = client.newCall(GET("$apiEndpoint/cont.imagesChap.php?cid=$id", headers)).execute() + + return req.asJsoup().select(pageListImageSelector).mapIndexed { i, img -> + Page(i, document.location(), getImgAttr(img)) + } + } +}