Add SeriManga (#2833)
* Add SeriManga * Update SeriManga.kt * Remove Printing to file
This commit is contained in:
parent
be986aa1fe
commit
ab31762778
|
@ -0,0 +1,12 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
ext {
|
||||
appName = 'Tachiyomi: SeriManga'
|
||||
pkgNameSuffix = 'tr.serimanga'
|
||||
extClass = '.SeriManga'
|
||||
extVersionCode = 1
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.0 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 |
|
@ -0,0 +1,109 @@
|
|||
package eu.kanade.tachiyomi.extension.tr.serimanga
|
||||
|
||||
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 java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class SeriManga : ParsedHttpSource() {
|
||||
override val name = "SeriManga"
|
||||
|
||||
override val baseUrl = "https://serimanga.com"
|
||||
|
||||
override val lang = "tr"
|
||||
|
||||
override val supportsLatest = true
|
||||
|
||||
override val client = network.cloudflareClient
|
||||
|
||||
override fun popularMangaSelector() = "a.manga-list-bg"
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request {
|
||||
if (page == 1) {
|
||||
return GET("$baseUrl/mangalar", headers)
|
||||
} else {
|
||||
return GET("$baseUrl/mangalar?page=$page", headers)
|
||||
}
|
||||
}
|
||||
|
||||
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
||||
setUrlWithoutDomain(element.attr("href"))
|
||||
title = element.select("span.mlb-name").text()
|
||||
thumbnail_url = styleToUrl(element).removeSurrounding("'")
|
||||
}
|
||||
|
||||
private fun styleToUrl(element: Element): String {
|
||||
return element.attr("style").substringAfter("(").substringBefore(")")
|
||||
}
|
||||
|
||||
override fun popularMangaNextPageSelector() = "[rel=next]"
|
||||
|
||||
override fun latestUpdatesSelector() = "a.sli2-img"
|
||||
|
||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/?a=a&page=$page", headers)
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element) = SManga.create().apply {
|
||||
setUrlWithoutDomain(element.attr("href"))
|
||||
title = element.attr("title")
|
||||
thumbnail_url = styleToUrl(element)
|
||||
}
|
||||
|
||||
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
|
||||
|
||||
override fun searchMangaSelector() = popularMangaSelector()
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = GET("$baseUrl/mangalar?search=Ab&page=$page", headers)
|
||||
|
||||
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
|
||||
|
||||
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
||||
|
||||
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
||||
description = document.select(".demo1").text()
|
||||
genre = document.select("div.spc2rcrc-links > a").joinToString { it.text() }
|
||||
status = document.select("div.is-status.is-status--green").text().let {
|
||||
parseStatus(it)
|
||||
}
|
||||
thumbnail_url = document.select("[rel=image_src]").attr("href")
|
||||
}
|
||||
|
||||
private fun parseStatus(status: String) = when {
|
||||
status.contains("CONTINUES") -> SManga.ONGOING
|
||||
status.contains("Tamamlanmış") -> SManga.COMPLETED
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
|
||||
override fun chapterListSelector() = "ul.spl-list > li"
|
||||
|
||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||
setUrlWithoutDomain(element.select("a").attr("href"))
|
||||
name = "${element.select("span").first().text()}: ${element.select("span").get(1).text()}"
|
||||
date_upload = dateFormat.parse(element.select("span").get(2).ownText()).time ?: 0
|
||||
}
|
||||
|
||||
companion object {
|
||||
val dateFormat by lazy {
|
||||
SimpleDateFormat("dd MMMM yyyy", Locale("tr"))
|
||||
}
|
||||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
return document.select("div.reader-manga > img").mapIndexed { i, element ->
|
||||
val url = if (element.hasAttr("data-src"))element.attr("data-src") else element.attr("src")
|
||||
Page(i, "", url)
|
||||
}
|
||||
}
|
||||
|
||||
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not Used")
|
||||
|
||||
override fun getFilterList() = FilterList()
|
||||
}
|
Loading…
Reference in New Issue