[New] Qimiaomh (#2093)

[New] Qimiaomh
This commit is contained in:
happywillow0 2020-01-19 10:21:20 -05:00 committed by arkon
parent 7a7915358c
commit d04e88d8b0
8 changed files with 122 additions and 0 deletions

View File

@ -0,0 +1,17 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
appName = 'Tachiyomi: Qimiaomh'
pkgNameSuffix = 'zh.qimiaomh'
extClass = '.Qimiaomh'
extVersionCode = 1
libVersion = '1.2'
}
dependencies {
compileOnly 'com.google.code.gson:gson:2.8.5'
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,105 @@
package eu.kanade.tachiyomi.extension.zh.qimiaomh
import com.github.salomonbrys.kotson.string
import com.google.gson.JsonParser
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.OkHttpClient
import okhttp3.Request
import java.util.*
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.concurrent.TimeUnit
class Qimiaomh : ParsedHttpSource() {
override val name: String = "奇妙漫画"
override val lang: String = "zh"
override val baseUrl: String = "https://www.qimiaomh.com"
override val supportsLatest: Boolean = true
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.connectTimeout(1, TimeUnit.MINUTES)
.readTimeout(1, TimeUnit.MINUTES)
.retryOnConnectionFailure(true)
.followRedirects(true)
.build()!!
// Popular
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/list-1------hits--$page.html", headers)
}
override fun popularMangaNextPageSelector(): String? = "a:contains(下一页)"
override fun popularMangaSelector(): String = "div.classification"
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
url = element.select("a").first().attr("href")
thumbnail_url = element.select("img.lazyload").attr("abs:data-src")
title = element.select("a").first().text()
}
//Latest
override fun latestUpdatesRequest(page: Int): Request {
return GET("$baseUrl/list-1------updatetime--$page.html", headers)
}
override fun latestUpdatesNextPageSelector(): String? = popularMangaNextPageSelector()
override fun latestUpdatesSelector(): String = popularMangaSelector()
override fun latestUpdatesFromElement(element: Element): SManga = popularMangaFromElement(element)
//Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
throw Exception("不管用 (T_T)")
//Todo Filters
}
override fun searchMangaNextPageSelector(): String? = popularMangaNextPageSelector()
override fun searchMangaSelector(): String = popularMangaSelector()
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
//Details
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
title = document.select("h1.title").text()
author = document.select("p.author").first().ownText()
artist = author
val glist = document.select("span.labelBox a").map { it.text() }
genre = glist.joinToString(", ")
description = document.select("p#worksDesc").text().trim()
thumbnail_url = document.select("div.ctdbLeft img").attr("src")
status = when (document.select("a.status").text().substringAfter(":").trim()) {
"连载中" -> SManga.ONGOING
"完结" -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
}
//Chapters
override fun chapterListSelector(): String = "div.comic-content-list ul.comic-content-c"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
url = element.select("a").first().attr("href")
name = element.select("li.tit").text().trim()
}
private fun parseDate(date: String): Long {
return SimpleDateFormat("dd/MM/yyyy", Locale.US ).parse(date).time
}
//Pages
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
val script = document.select("script:containsData(var did =)").html()
var did = script.substringAfter("var did = ").substringBefore(";")
var sid = script.substringAfter("var sid = ").substringBefore(";")
val url = "$baseUrl/Action/Play/AjaxLoadImgUrl?did=$did&sid=$sid&tmp=${Random().nextFloat()}"
val body = client.newCall(GET(url, headers)).execute().body()!!.string()
val json = JsonParser().parse(body).asJsonObject
val images = json["listImg"].asJsonArray
images.forEachIndexed { index, jsonElement ->
add(Page(index, "", jsonElement.string))
}
}
override fun imageUrlParse(document: Document): String {
throw Exception("Not Used")
}
//Not Used
}