[New] Mangacruzers (#1934)

This commit is contained in:
happywillow0 2020-01-07 10:43:31 -05:00 committed by Carlos
parent 8c01e58bd1
commit 2f12ba1de3
8 changed files with 133 additions and 0 deletions

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -0,0 +1,118 @@
package eu.kanade.tachiyomi.extension.en.mangacruzers
import android.net.Uri
import android.util.Log
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.*
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.TimeUnit
class mangacruzers : ParsedHttpSource() {
override val name = "Manga Cruzers"
override val baseUrl = "https://ww2.mangacruzers.com"
override val lang = "en"
override val supportsLatest = false
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.connectTimeout(1, TimeUnit.MINUTES)
.readTimeout(1, TimeUnit.MINUTES)
.retryOnConnectionFailure(true)
.followRedirects(true)
.build()!!
override fun popularMangaSelector() = "tr"//"td > a:not(a[href*=Cruzers])"
override fun latestUpdatesSelector() = throw Exception ("Not Used")
override fun searchMangaSelector() = popularMangaSelector()
override fun chapterListSelector() = "div.flex.items-center > div.flex.flex-col:not(.items-center), tbody.no-border-x > tr"
override fun popularMangaNextPageSelector() = "none"
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
override fun popularMangaRequest(page: Int) = GET("$baseUrl/read-manga/", headers)
override fun latestUpdatesRequest(page: Int) = throw Exception ("Not Used")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = throw Exception ("Not Used")
override fun popularMangaParse(response: Response): MangasPage {
val document = response.asJsoup()
val mangas = mutableListOf<SManga>()
val element = document.select(popularMangaSelector())
for (i in 1 until element.size-2) {
mangas.add(mangaFromElement(element[i]))
}
return MangasPage(mangas, false)
}
override fun mangaDetailsRequest(manga: SManga) = chapterListRequest(manga)
override fun pageListRequest(chapter: SChapter) = GET(chapter.url, headers)
override fun chapterListRequest(manga: SManga): Request {
val document = client.newCall(GET(manga.url, headers)).execute().asJsoup()
val select = document.select("a:containsOwn(View all chapters)")
val url = if (!select.isNullOrEmpty()) {
select.first().attr("href")
} else {
manga.url
}
return GET(url, headers)
}
override fun popularMangaFromElement(element: Element) = mangaFromElement(element)
override fun latestUpdatesFromElement(element: Element) = mangaFromElement(element)
override fun searchMangaFromElement(element: Element)= mangaFromElement(element)
private fun mangaFromElement(element: Element): SManga {
val manga = SManga.create()
manga.url = element.select("a").attr("abs:href")
manga.title = element.select("td").first().text().trim()
return manga
}
private fun parseDate(date: String): Long {
return SimpleDateFormat("MMM dd, yyyy", Locale.US ).parse(date).time
}
override fun chapterFromElement(element: Element) = SChapter.create().apply {
url = element.select("a").first().attr("abs:href")
val td = element.select("td")
if (!td.isNullOrEmpty()) {
name = td[0].text()
date_upload = parseDate(td[1].text())
} else {
val substring = element.select("div.text-xs").text()
name = element.select("a").text() + if (!substring.isNullOrBlank()) { " - $substring" } else {""}
}
}
override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create()
manga.title = document.select("h1.text-white").text().removePrefix("READ").removeSuffix("ONLINE").trim()
manga.thumbnail_url = document.select("img.border-8, img.card-img-top, img.card-img-right").attr("src")
manga.description = document.select("div:containsOwn(Description) + div, div.align-items-start > p:eq(2)").text()
return manga
}
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
document.select("img.my-3, img.pages__img")?.forEach {
pages.add(Page(pages.size, "", it.attr("src")))
}
return pages
}
override fun imageUrlRequest(page: Page) = throw Exception("Not used")
override fun imageUrlParse(document: Document) = throw Exception("Not used")
}