Remove Heavenmanga, NANI (1/2) (#1595)

This commit is contained in:
Mike 2019-10-02 20:05:53 -04:00 committed by arkon
parent 48fb43fc05
commit d920a2e990
16 changed files with 0 additions and 439 deletions

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

View File

@ -1,277 +0,0 @@
package eu.kanade.tachiyomi.extension.en.heavenmanga
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.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.*
class Heavenmanga : ParsedHttpSource() {
override val name = "Heaven Manga"
override val baseUrl = "http://ww2.heavenmanga.org"
override val lang = "en"
override val supportsLatest = true
override val client: OkHttpClient = network.cloudflareClient
// selectors
override fun popularMangaSelector() = "div.comics-grid div.entry"
override fun latestUpdatesSelector() = popularMangaSelector()
override fun searchMangaSelector() = popularMangaSelector()
override fun chapterListSelector() = "div.chapters-wrapper div.two-rows a"
override fun popularMangaNextPageSelector() = "a.next[href^=http:]:has(i.fa-angle-right)"
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
// popular
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/manga-list/page-$page", headers)
}
override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create()
val item = element.select("h3 a")
manga.url = item.attr("href")
manga.title = item.text()
manga.thumbnail_url = element.select("a.thumb > img").attr("src")
return manga
}
// latest
override fun latestUpdatesRequest(page: Int): Request {
return GET("$baseUrl/latest-update/page-$page", headers)
}
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
// search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = if (query.isNotBlank()) {
"$baseUrl/?s=$query"
} else {
var ret = String()
var genre:String
var name:String
var authorFilter: String? = null
filters.forEach { filter ->
when (filter) {
is TextField -> {
if (filter.key == "author" && !filter.state.isEmpty()) {
authorFilter = filter.state
if (!authorFilter.isNullOrEmpty()) {
ret = "$baseUrl/author/$authorFilter/page-$page"
}
}
}
is GenreFilter -> {
if(filter.toUriPart().isNotBlank() && filter.state != 0) {
name = filter.toUriPart()
genre = if(name == "completed") "completed" else "genre/$name"
ret = "$baseUrl/$genre/page-$page"
}
}
}
}
ret
}
return GET(url, headers)
}
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
// details
override fun mangaDetailsRequest(manga: SManga): Request {
if (manga.url.startsWith("http")) {
return GET(manga.url, headers)
}
return super.mangaDetailsRequest(manga)
}
override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div.comic-info")
val manga = SManga.create()
val author = infoElement.select("div.author").text()
val genre = infoElement.select("div.genre").text()
val status = infoElement.select("div.update > span:eq(1)").text()
manga.title = infoElement.select("h1.name").text()
manga.author = author.substring(author.indexOf(":") + 2)
manga.status = parseStatus(status)
manga.genre = genre.substring(genre.indexOf(":") + 2)
manga.description = document.select("div.comic-description p").text()
manga.thumbnail_url = infoElement.select("div.thumb img").attr("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
}
// chapter
override fun chapterListRequest(manga: SManga): Request {
if (manga.url.startsWith("http")) {
return GET(manga.url, headers)
}
return super.chapterListRequest(manga)
}
// copied from en-holymanga extension
override fun chapterListParse(response: Response): List<SChapter> {
val allChapters = mutableListOf<SChapter>()
val paginationSelector = latestUpdatesNextPageSelector()
var document = response.asJsoup()
var dateIndex = 0
var continueParsing = true
// Chapter list is paginated
while (continueParsing) {
// Chapter titles and urls
document.select(chapterListSelector()).map{allChapters.add(chapterFromElement(it))}
// Chapter dates
document.select("div.chapter-date").forEach {
if (it.hasText()) allChapters[dateIndex].date_upload = parseDate(it.text())
dateIndex++
}
// Next page of chapters
if (document.select(paginationSelector).isNotEmpty()) {
document = client.newCall(GET(document.select(paginationSelector)
.attr("href"), headers)).execute().asJsoup()
} else {
continueParsing = false
}
}
return allChapters
}
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
chapter.setUrlWithoutDomain(element.attr("href"))
chapter.name = element.text()
return chapter
}
private fun parseDate(date: String): Long {
return SimpleDateFormat("MM/dd/yyyy", Locale.US).parse(date).time
}
// pages
override fun pageListRequest(chapter: SChapter): Request {
if (chapter.url.startsWith("http")) {
return GET(chapter.url, headers)
}
return super.pageListRequest(chapter)
}
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
document.select("div.chapter-content img").forEach {
val url = it.attr("src")
if (url != "") {
pages.add(Page(pages.size, "", url))
}
}
return pages
}
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
// filters
private class TextField(name: String, val key: String) : Filter.Text(name)
override fun getFilterList() = FilterList(
Filter.Header("Filters cannot be used while searching."),
Filter.Separator(),
Filter.Header("An invalid author will return mangas from all authors."),
Filter.Separator("-----------------"),
TextField("Author", "author"),
GenreFilter ()
)
// [...document.querySelectorAll('.sub-menu li a')].map(a => `Pair("${a.textContent}", "${a.getAttribute('href')}")`).join(',\n')
// from $baseUrl
private class GenreFilter: UriPartFilter("Genres",
arrayOf(
Pair("Choose a genre", ""),
Pair("Action", "action"),
Pair("Adult", "adult"),
Pair("Anime", "anime"),
Pair("Adventure", "adventure"),
Pair("Comedy", "comedy"),
Pair("Comic", "comic"),
Pair("Completed", "completed"),
Pair("Cooking", "cooking"),
Pair("Doraemon", "doraemon"),
Pair("Doujinshi", "doujinshi"),
Pair("Drama", "drama"),
Pair("Ecchi", "ecchi"),
Pair("Fantasy", "fantasy"),
Pair("Full Color", "full-color"),
Pair("Gender Bender", "gender-bender"),
Pair("Harem", "harem"),
Pair("Historical", "historical"),
Pair("Horror", "horror"),
Pair("Josei", "josei"),
Pair("Live action", "live-action"),
Pair("Magic", "magic"),
Pair("Manga", "manga"),
Pair("Manhua", "manhua"),
Pair("Manhwa", "manhwa"),
Pair("Martial Arts", "martial-arts"),
Pair("Mature", "mature"),
Pair("Mecha", "mecha"),
Pair("Mystery", "mystery"),
Pair("One shot", "one-shot"),
Pair("Psychological", "psychological"),
Pair("Romance", "romance"),
Pair("School Life", "school-life"),
Pair("Sci-fi", "sci-fi"),
Pair("Seinen", "seinen"),
Pair("Shoujo", "shoujo"),
Pair("Shoujo Ai", "shoujo-ai"),
Pair("Shounen", "shounen"),
Pair("Shounen Ai", "shounen-ai"),
Pair("Slice of life", "slice-of-life"),
Pair("Smut", "smut"),
Pair("Yaoi", "yaoi"),
Pair("Yuri", "yuri"),
Pair("Sports", "sports"),
Pair("Supernatural", "supernatural"),
Pair("Tragedy", "tragedy"),
Pair("Trap", "trap"),
Pair("Webtoons", "webtoons")
)
)
private open class UriPartFilter(displayName: String, val vals: Array<Pair<String, String>>) :
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
fun toUriPart() = vals[state].second
}
}

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

View File

@ -1,138 +0,0 @@
package eu.kanade.tachiyomi.extension.en.naniscans
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import rx.Observable
import java.text.SimpleDateFormat
class NaniScans : ParsedHttpSource() {
override val baseUrl = "https://naniscans.xyz"
override val lang = "en"
override val name = "NANI? Scans"
override val supportsLatest = true
private val projects = "$baseUrl/projects"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
val chapterLink = element.select("div.col-8.text-truncate.d-inline-flex.flex-nowrap > a:nth-child(2)")
setUrlWithoutDomain("${chapterLink.attr("href")}?mode=Manga")
this.name = chapterLink.text().trim()
this.date_upload = SimpleDateFormat("dd/MM/yyyy").parse(element.select("div.col-4.text-truncate > span").text().trim()).time
}
override fun chapterListSelector() = "#chapter_list > div"
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return client.newCall(searchMangaRequest(page, query, filters)).asObservableSuccess().map {
searchMangaParse(it, query)
}
}
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
override fun latestUpdatesFromElement(element: Element) = throw UnsupportedOperationException("Not used")
override fun latestUpdatesNextPageSelector() = null
override fun latestUpdatesParse(response: Response): MangasPage {
val updates = response.asJsoup().select(latestUpdatesSelector())
val series = mutableMapOf<String, SManga>()
updates.forEach {
SManga.create().run {
setUrlWithoutDomain(it.attr("href"))
title = it.text().trim()
series.put(title, this)
}
}
return MangasPage(series.values.toList(), false)
}
override fun latestUpdatesRequest(page: Int) = GET(baseUrl)
override fun latestUpdatesSelector() = "body > div.container.mt-3 > div > div.col-lg-8 > div > div > div > div > div.pt-0.pb-1.mb-1.border-bottom.border-secondary.d-flex.align-items-center.flex-nowrap > a"
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
val element = document.select("body > div.container.mt-3 > div:nth-child(2) > div")
author = element.select("span:nth-child(3)").text().trim()
artist = element.select("span:nth-child(6)").text().trim()
description = element.select("span:nth-child(9)").text().trim()
thumbnail_url = "$baseUrl${document.select("#manga_page").attr("src")}"
status = parseStatus(element.select("span:nth-child(12)").text().trim())
}
override fun pageListParse(document: Document): List<Page> {
val docString = document.toString()
val pages = mutableListOf<Page>()
val imageUrls = docString.substringAfter("const pages = [", "").substringBefore("];", "").split(",").map { it.replace("\"", "") }
imageUrls.forEach {
pages.add(Page(pages.size, "", "$baseUrl${it.trim()}"))
}
return pages
}
override fun popularMangaFromElement(element: Element) = throw UnsupportedOperationException("Not used")
override fun popularMangaNextPageSelector() = null
override fun popularMangaParse(response: Response): MangasPage {
val updates = response.asJsoup().select(popularMangaSelector())
val series = mutableListOf<SManga>()
updates.forEach {
SManga.create().run {
setUrlWithoutDomain(it.attr("href"))
title = it.text().trim()
series.add(this)
}
}
return MangasPage(series, false)
}
override fun popularMangaRequest(page: Int) = GET(projects)
override fun popularMangaSelector() = "body > div.container.mt-3 > div > div.col-lg-8 > div > div > div > div > div > div > h6 > a"
override fun searchMangaFromElement(element: Element) = throw UnsupportedOperationException("Not used")
override fun searchMangaNextPageSelector() = null
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = popularMangaRequest(page)
override fun searchMangaSelector() = popularMangaSelector()
private fun parseStatus(status: String) = when {
status.contains("Ongoing") -> SManga.ONGOING
status.contains("Completed") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
private fun searchMangaParse(response: Response, query: String): MangasPage {
val updates = response.asJsoup().select(popularMangaSelector())
val series = mutableListOf<SManga>()
updates.forEach {
SManga.create().run {
setUrlWithoutDomain(it.attr("href"))
title = it.text().trim()
if (title.contains(query, true))
series.add(this)
}
}
return MangasPage(series, false)
}
}