MerakiScans update (#2053)

This commit is contained in:
Mike 2020-01-13 07:22:36 -05:00 committed by Carlos
parent 6e95420b7b
commit b86258d5a7
2 changed files with 13 additions and 31 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: MerakiScans'
pkgNameSuffix = 'en.merakiscans'
extClass = '.MerakiScans'
extVersionCode = 5
extVersionCode = 6
libVersion = '1.2'
}

View File

@ -12,6 +12,7 @@ import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.ParseException
import java.text.SimpleDateFormat
import java.util.Locale
class MerakiScans : ParsedHttpSource() {
override val name = "MerakiScans"
@ -26,11 +27,10 @@ class MerakiScans : ParsedHttpSource() {
companion object {
val dateFormat by lazy {
SimpleDateFormat("MMM dd, yyyy")
SimpleDateFormat("MMM dd, yyyy", Locale.US)
}
}
override fun popularMangaSelector() = "#all > #listitem > a"
override fun latestUpdatesSelector() = "#mangalisthome > #mangalistitem > #mangaitem > #manganame > a"
@ -39,7 +39,7 @@ class MerakiScans : ParsedHttpSource() {
= GET("$baseUrl/manga", headers)
override fun latestUpdatesRequest(page: Int)
= GET("$baseUrl", headers)
= GET(baseUrl, headers)
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.attr("href"))
@ -51,9 +51,9 @@ class MerakiScans : ParsedHttpSource() {
title = element.text().trim()
}
override fun popularMangaNextPageSelector() = null
override fun popularMangaNextPageSelector(): String? = null
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun latestUpdatesNextPageSelector(): String? = null
override fun searchMangaRequest(page: Int, query: String, filters: FilterList)
= GET("$baseUrl/manga", headers)
@ -65,7 +65,7 @@ class MerakiScans : ParsedHttpSource() {
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
override fun searchMangaNextPageSelector() = null
override fun searchMangaNextPageSelector(): String? = null
private fun searchMangaParse(response: Response, query: String): MangasPage {
val document = response.asJsoup()
@ -74,11 +74,7 @@ class MerakiScans : ParsedHttpSource() {
searchMangaFromElement(element)
}
val hasNextPage = searchMangaNextPageSelector()?.let { selector ->
document.select(selector).first()
} != null
return MangasPage(mangas, hasNextPage)
return MangasPage(mangas, false)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
@ -93,14 +89,12 @@ class MerakiScans : ParsedHttpSource() {
val infoElement = document.select("#content2")
author = infoElement.select("#detail_list > li:nth-child(5)").text().replace("Author:","").trim()
artist = infoElement.select("#detail_list > li:nth-child(7)").text().replace("Artist:","").trim()
genre = infoElement.select("#detail_list > li:nth-child(11) > a").map {
it.text().trim()
}.joinToString(", ")
genre = infoElement.select("#detail_list > li:nth-child(11) > a").joinToString { it.text().trim() }
status = infoElement.select("#detail_list > li:nth-child(9)").text().replace("Status:","").trim().let {
parseStatus(it)
}
description = infoElement.select("#detail_list > span").text().trim()
thumbnail_url = "$baseUrl" + infoElement.select("#info > #image > #cover_img").attr("src")
thumbnail_url = infoElement.select("#info > #image > #cover_img").attr("abs:src")
}
private fun parseStatus(status: String) = when {
@ -109,16 +103,6 @@ class MerakiScans : ParsedHttpSource() {
else -> SManga.UNKNOWN
}
override fun chapterListParse(response: Response): List<SChapter> {
var response = response
val chapters = mutableListOf<SChapter>()
val document = response.asJsoup()
document.select(chapterListSelector()).forEach {
chapters.add(chapterFromElement(it))
}
return chapters
}
override fun chapterListSelector() = "#chapter_table > tbody > #chapter-head"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
@ -140,12 +124,10 @@ class MerakiScans : ParsedHttpSource() {
val imgarray = doc.substringAfter("var images = [").substringBefore("];").split(",").map { it.replace("\"","") }
val mangaslug = doc.substringAfter("var manga_slug = \"").substringBefore("\";")
val chapnum = doc.substringAfter("var viewschapter = \"").substringBefore("\";")
val pages = mutableListOf<Page>()
//$it
imgarray.forEach {
pages.add(Page(pages.size, "", "$baseUrl/manga/$mangaslug/$chapnum/$it"))
return imgarray.mapIndexed { i, image ->
Page(i, "", "$baseUrl/manga/$mangaslug/$chapnum/$image")
}
return pages
}
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")