MerakiScans update (#2053)
This commit is contained in:
parent
6e95420b7b
commit
b86258d5a7
@ -5,7 +5,7 @@ ext {
|
|||||||
appName = 'Tachiyomi: MerakiScans'
|
appName = 'Tachiyomi: MerakiScans'
|
||||||
pkgNameSuffix = 'en.merakiscans'
|
pkgNameSuffix = 'en.merakiscans'
|
||||||
extClass = '.MerakiScans'
|
extClass = '.MerakiScans'
|
||||||
extVersionCode = 5
|
extVersionCode = 6
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import org.jsoup.nodes.Document
|
|||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.text.ParseException
|
import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class MerakiScans : ParsedHttpSource() {
|
class MerakiScans : ParsedHttpSource() {
|
||||||
override val name = "MerakiScans"
|
override val name = "MerakiScans"
|
||||||
@ -26,11 +27,10 @@ class MerakiScans : ParsedHttpSource() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val dateFormat by lazy {
|
val dateFormat by lazy {
|
||||||
SimpleDateFormat("MMM dd, yyyy")
|
SimpleDateFormat("MMM dd, yyyy", Locale.US)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun popularMangaSelector() = "#all > #listitem > a"
|
override fun popularMangaSelector() = "#all > #listitem > a"
|
||||||
|
|
||||||
override fun latestUpdatesSelector() = "#mangalisthome > #mangalistitem > #mangaitem > #manganame > a"
|
override fun latestUpdatesSelector() = "#mangalisthome > #mangalistitem > #mangaitem > #manganame > a"
|
||||||
@ -39,7 +39,7 @@ class MerakiScans : ParsedHttpSource() {
|
|||||||
= GET("$baseUrl/manga", headers)
|
= GET("$baseUrl/manga", headers)
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int)
|
override fun latestUpdatesRequest(page: Int)
|
||||||
= GET("$baseUrl", headers)
|
= GET(baseUrl, headers)
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
||||||
setUrlWithoutDomain(element.attr("href"))
|
setUrlWithoutDomain(element.attr("href"))
|
||||||
@ -51,9 +51,9 @@ class MerakiScans : ParsedHttpSource() {
|
|||||||
title = element.text().trim()
|
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)
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList)
|
||||||
= GET("$baseUrl/manga", headers)
|
= GET("$baseUrl/manga", headers)
|
||||||
@ -65,7 +65,7 @@ class MerakiScans : ParsedHttpSource() {
|
|||||||
|
|
||||||
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
|
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
|
||||||
|
|
||||||
override fun searchMangaNextPageSelector() = null
|
override fun searchMangaNextPageSelector(): String? = null
|
||||||
|
|
||||||
private fun searchMangaParse(response: Response, query: String): MangasPage {
|
private fun searchMangaParse(response: Response, query: String): MangasPage {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
@ -74,11 +74,7 @@ class MerakiScans : ParsedHttpSource() {
|
|||||||
searchMangaFromElement(element)
|
searchMangaFromElement(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
val hasNextPage = searchMangaNextPageSelector()?.let { selector ->
|
return MangasPage(mangas, false)
|
||||||
document.select(selector).first()
|
|
||||||
} != null
|
|
||||||
|
|
||||||
return MangasPage(mangas, hasNextPage)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
@ -93,14 +89,12 @@ class MerakiScans : ParsedHttpSource() {
|
|||||||
val infoElement = document.select("#content2")
|
val infoElement = document.select("#content2")
|
||||||
author = infoElement.select("#detail_list > li:nth-child(5)").text().replace("Author:","").trim()
|
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()
|
artist = infoElement.select("#detail_list > li:nth-child(7)").text().replace("Artist:","").trim()
|
||||||
genre = infoElement.select("#detail_list > li:nth-child(11) > a").map {
|
genre = infoElement.select("#detail_list > li:nth-child(11) > a").joinToString { it.text().trim() }
|
||||||
it.text().trim()
|
|
||||||
}.joinToString(", ")
|
|
||||||
status = infoElement.select("#detail_list > li:nth-child(9)").text().replace("Status:","").trim().let {
|
status = infoElement.select("#detail_list > li:nth-child(9)").text().replace("Status:","").trim().let {
|
||||||
parseStatus(it)
|
parseStatus(it)
|
||||||
}
|
}
|
||||||
description = infoElement.select("#detail_list > span").text().trim()
|
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 {
|
private fun parseStatus(status: String) = when {
|
||||||
@ -109,16 +103,6 @@ class MerakiScans : ParsedHttpSource() {
|
|||||||
else -> SManga.UNKNOWN
|
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 chapterListSelector() = "#chapter_table > tbody > #chapter-head"
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
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 imgarray = doc.substringAfter("var images = [").substringBefore("];").split(",").map { it.replace("\"","") }
|
||||||
val mangaslug = doc.substringAfter("var manga_slug = \"").substringBefore("\";")
|
val mangaslug = doc.substringAfter("var manga_slug = \"").substringBefore("\";")
|
||||||
val chapnum = doc.substringAfter("var viewschapter = \"").substringBefore("\";")
|
val chapnum = doc.substringAfter("var viewschapter = \"").substringBefore("\";")
|
||||||
val pages = mutableListOf<Page>()
|
|
||||||
//$it
|
return imgarray.mapIndexed { i, image ->
|
||||||
imgarray.forEach {
|
Page(i, "", "$baseUrl/manga/$mangaslug/$chapnum/$image")
|
||||||
pages.add(Page(pages.size, "", "$baseUrl/manga/$mangaslug/$chapnum/$it"))
|
|
||||||
}
|
}
|
||||||
return pages
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
|
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user