MangaOwl, new extension (#1505)

MangaOwl, new extension
This commit is contained in:
Mike 2019-09-14 10:32:50 -04:00 committed by arkon
parent 5c4193063b
commit 907ec95e8a
8 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
appName = 'Tachiyomi: MangaOwl'
pkgNameSuffix = 'en.mangaowl'
extClass = '.MangaOwl'
extVersionCode = 1
libVersion = '1.2'
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

View File

@ -0,0 +1,134 @@
package eu.kanade.tachiyomi.extension.en.mangaowl
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 org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.*
class MangaOwl : ParsedHttpSource() {
override val name = "MangaOwl"
override val baseUrl = "http://mangaowl.com"
override val lang = "en"
override val supportsLatest = true
override val client: OkHttpClient = network.cloudflareClient
// Popular
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/popular/$page", headers)
}
override fun popularMangaSelector() = "div.col-md-2"
override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create()
element.select("h6 a").let {
manga.setUrlWithoutDomain(it.attr("href"))
manga.title = it.text()
}
manga.thumbnail_url = element.select("div.img-responsive").attr("abs:data-background-image")
return manga
}
override fun popularMangaNextPageSelector() = "div.blog-pagenat-wthree li a:contains(>>)"
// Latest
override fun latestUpdatesRequest(page: Int): Request {
return GET("$baseUrl/lastest/$page", headers)
}
override fun latestUpdatesSelector() = popularMangaSelector()
override fun latestUpdatesFromElement(element: Element): SManga = popularMangaFromElement(element)
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
// Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search/$query/$page", headers)
}
override fun searchMangaSelector() = popularMangaSelector()
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
override fun searchMangaNextPageSelector() = "div.navigation li a:contains(next)"
// Manga summary page
override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div.col-sm-8").first()
val manga = SManga.create()
manga.title = infoElement.select("h2").first().ownText()
manga.author = infoElement.select("p:contains(author)").first().ownText()
val status = infoElement.select("p:contains(pub. status)").first().ownText()
manga.status = parseStatus(status)
manga.genre = infoElement.select("a.label").mapNotNull{ it.text() }.joinToString(", ")
manga.description = infoElement.select("div.single-right-grids.description").first().ownText()
manga.thumbnail_url = infoElement.select("div.col-xs-offset-1 img").attr("abs:data-src")
return manga
}
private fun parseStatus(status: String?) = when {
status == null -> SManga.UNKNOWN
status.contains("Ongoing") -> SManga.ONGOING
status.contains("Completed") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
// Chapters
override fun chapterListSelector() = "div.table-chapter-list table.table-responsive-md tr"
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
element.select("a").let {
chapter.setUrlWithoutDomain(it.attr("href"))
chapter.name = it.text()
}
chapter.date_upload = parseChapterDate(element.select("td + td").text())
return chapter
}
companion object {
val dateFormat by lazy {
SimpleDateFormat("MM/dd/yyyy", Locale.US)
}
}
private fun parseChapterDate(string: String): Long {
return dateFormat.parse(string).time
}
// Pages
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
document.select("div.item img.owl-lazy").forEachIndexed { i, img ->
pages.add(Page(i, "", img.attr("abs:data-src")))
}
return pages
}
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
override fun getFilterList() = FilterList()
}