myreadingmanga fix again (#552)

This commit is contained in:
Carlos 2018-10-13 15:54:37 -04:00 committed by GitHub
parent ab49ffef91
commit 5e861d3c4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -5,8 +5,8 @@ ext {
appName = 'Tachiyomi: MyReadingManga' appName = 'Tachiyomi: MyReadingManga'
pkgNameSuffix = 'all.myreadingmanga' pkgNameSuffix = 'all.myreadingmanga'
extClass = '.MyReadingMangaFactory' extClass = '.MyReadingMangaFactory'
extVersionCode = 8 extVersionCode = 9
extVersionSuffix = 7 extVersionSuffix = 8
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -69,16 +69,18 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() {
val manga = SManga.create() val manga = SManga.create()
manga.setUrlWithoutDomain(titleElement.attr("href")) manga.setUrlWithoutDomain(titleElement.attr("href"))
manga.title = cleanTitle(titleElement.text()) manga.title = cleanTitle(titleElement.text())
manga.thumbnail_url = manga.thumbnail_url = getThumbnail(getImage(thumbnailElement))
when {
thumbnailElement.attr("data-src").endsWith(".jpg") -> getThumbnail(thumbnailElement.attr("data-src"))
thumbnailElement.attr("src").endsWith(".jpg") -> getThumbnail(thumbnailElement.attr("src"))
else -> getThumbnail(thumbnailElement.attr("data-lazy-src"))
}
return manga return manga
} }
private fun getImage(element: Element): String {
return when {
element.attr("data-src").endsWith(".jpg") -> element.attr("data-src")
element.attr("src").endsWith(".jpg") -> element.attr("src")
else -> element.attr("data-lazy-src")
}
}
//removes resizing //removes resizing
private fun getThumbnail(thumbnailUrl: String) = thumbnailUrl.substringBeforeLast("-") + "." + thumbnailUrl.substringAfterLast(".") private fun getThumbnail(thumbnailUrl: String) = thumbnailUrl.substringBeforeLast("-") + "." + thumbnailUrl.substringAfterLast(".")
@ -136,7 +138,6 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() {
override fun searchMangaNextPageSelector() = null override fun searchMangaNextPageSelector() = null
override fun chapterFromElement(element: Element) = throw Exception("Not used") override fun chapterFromElement(element: Element) = throw Exception("Not used")
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
@ -144,7 +145,7 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() {
val pages = mutableListOf<Page>() val pages = mutableListOf<Page>()
val elements = body.select("div.separator > img") val elements = body.select("div.separator > img")
(0 until elements.size).mapTo(pages) { Page(it, "", elements[it].attr("data-src")) } (0 until elements.size).mapTo(pages) { Page(it, "", getImage(elements[it])) }
return pages return pages
} }