diff --git a/src/zh/haomanwu/AndroidManifest.xml b/src/zh/haomanwu/AndroidManifest.xml new file mode 100644 index 000000000..30deb7f79 --- /dev/null +++ b/src/zh/haomanwu/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/src/zh/haomanwu/build.gradle b/src/zh/haomanwu/build.gradle new file mode 100644 index 000000000..a79723531 --- /dev/null +++ b/src/zh/haomanwu/build.gradle @@ -0,0 +1,11 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + extName = 'Haomanwu' + pkgNameSuffix = 'zh.haomanwu' + extClass = '.Haomanwu' + extVersionCode = 1 +} + +apply from: "$rootDir/common.gradle" diff --git a/src/zh/haomanwu/res/mipmap-hdpi/ic_launcher.png b/src/zh/haomanwu/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..85e849b82 Binary files /dev/null and b/src/zh/haomanwu/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/zh/haomanwu/res/mipmap-mdpi/ic_launcher.png b/src/zh/haomanwu/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..1c9a9b7f8 Binary files /dev/null and b/src/zh/haomanwu/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/zh/haomanwu/res/mipmap-xhdpi/ic_launcher.png b/src/zh/haomanwu/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..125683766 Binary files /dev/null and b/src/zh/haomanwu/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/zh/haomanwu/res/mipmap-xxhdpi/ic_launcher.png b/src/zh/haomanwu/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..fbfdb3912 Binary files /dev/null and b/src/zh/haomanwu/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/zh/haomanwu/res/mipmap-xxxhdpi/ic_launcher.png b/src/zh/haomanwu/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..3781e341a Binary files /dev/null and b/src/zh/haomanwu/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/zh/haomanwu/res/web_hi_res_512.png b/src/zh/haomanwu/res/web_hi_res_512.png new file mode 100644 index 000000000..54f8cc96c Binary files /dev/null and b/src/zh/haomanwu/res/web_hi_res_512.png differ diff --git a/src/zh/haomanwu/src/eu/kanade/tachiyomi/extension/zh/haomanwu/Haomanwu.kt b/src/zh/haomanwu/src/eu/kanade/tachiyomi/extension/zh/haomanwu/Haomanwu.kt new file mode 100644 index 000000000..1b5ddadcc --- /dev/null +++ b/src/zh/haomanwu/src/eu/kanade/tachiyomi/extension/zh/haomanwu/Haomanwu.kt @@ -0,0 +1,81 @@ +package eu.kanade.tachiyomi.extension.zh.haomanwu + +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +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.source.online.ParsedHttpSource +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element + +class Haomanwu : ParsedHttpSource() { + override val name: String = "好漫屋" + override val lang: String = "zh" + override val supportsLatest: Boolean = true + override val baseUrl: String = "https://app2.haomanwu.com" + + // Popular + + override fun popularMangaRequest(page: Int) = GET("$baseUrl/category/order/hits/page/$page", headers) + override fun popularMangaNextPageSelector(): String? = "div#Pagination a.next" + override fun popularMangaSelector(): String = "div.cate-comic-list > div.common-comic-item" + override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { + title = element.select("p.comic__title > a").text() + url = element.select("p.comic__title > a").attr("href") + thumbnail_url = element.select("img").attr("data-original") + } + + // Latest + + override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/category/order/addtime/page/$page", headers) + override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() + override fun latestUpdatesSelector() = popularMangaSelector() + override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element) + + // Search + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + return GET("$baseUrl/index.php/search?key=$query", headers) + } + + override fun searchMangaNextPageSelector(): String? = null + override fun searchMangaSelector(): String = "li > a" + override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { + title = element.text() + url = element.attr("href") + } + + // Details + + override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { + title = document.select("p.comic-title").text() + thumbnail_url = document.select("div.de-info__cover > img").attr("src") + author = document.select("div.comic-author > span.name > a").text() + artist = author + genre = document.select("div.comic-status > span.text:nth-child(1) a").eachText().joinToString(", ") + description = document.select("p.intro-total").text() + } + + // Chapters + + override fun chapterListSelector(): String = "ul.chapter__list-box > li" + override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { + url = element.select("a").attr("href") + name = element.select("a").text() + } + override fun chapterListParse(response: Response): List { + return super.chapterListParse(response).reversed() + } + + // Pages + + override fun pageListParse(document: Document): List { + return document.select("div.rd-article__pic > img.lazy-read") + .mapIndexed { i, el -> Page(i, "", el.attr("data-original")) } + } + + override fun imageUrlParse(document: Document): String = throw Exception("Not Used") +}