Fix wnacg thumbnails loading (#4489)
* Fix wnacg thumbnails loading * Fix wnacg thumbnails loading
This commit is contained in:
parent
b9401c7a6d
commit
e4e18beaa2
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'WNACG'
|
extName = 'WNACG'
|
||||||
pkgNameSuffix = 'zh.wnacg'
|
pkgNameSuffix = 'zh.wnacg'
|
||||||
extClass = '.wnacg'
|
extClass = '.wnacg'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import okhttp3.Headers
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
|
@ -30,6 +31,7 @@ class wnacg : ParsedHttpSource() {
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
override fun popularMangaRequest(page: Int): Request {
|
||||||
return GET("$baseUrl/albums-index-page-$page.html", headers)
|
return GET("$baseUrl/albums-index-page-$page.html", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) = throw Exception("Not used")
|
override fun latestUpdatesRequest(page: Int) = throw Exception("Not used")
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
@ -40,15 +42,24 @@ class wnacg : ParsedHttpSource() {
|
||||||
override fun chapterListRequest(manga: SManga) = mangaDetailsRequest(manga)
|
override fun chapterListRequest(manga: SManga) = mangaDetailsRequest(manga)
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter) = GET(baseUrl + chapter.url, headers)
|
override fun pageListRequest(chapter: SChapter) = GET(baseUrl + chapter.url, headers)
|
||||||
|
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
|
||||||
|
.set("referer", baseUrl)
|
||||||
|
.set("sec-fetch-mode", "no-cors")
|
||||||
|
.set("sec-fetch-site", "cross-site")
|
||||||
|
.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36")
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element) = mangaFromElement(element)
|
override fun popularMangaFromElement(element: Element) = mangaFromElement(element)
|
||||||
override fun latestUpdatesFromElement(element: Element) = throw Exception("Not used")
|
override fun latestUpdatesFromElement(element: Element) = throw Exception("Not used")
|
||||||
override fun searchMangaFromElement(element: Element) = mangaFromElement(element)
|
override fun searchMangaFromElement(element: Element) = mangaFromElement(element)
|
||||||
|
|
||||||
private fun mangaFromElement(element: Element): SManga {
|
private fun mangaFromElement(element: Element): SManga {
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.setUrlWithoutDomain(element.select("a").first().attr("href"))
|
manga.setUrlWithoutDomain(element.select("a").first().attr("href"))
|
||||||
manga.title = element.select("a").attr("title").trim()
|
manga.title = element.select("a").attr("title").trim()
|
||||||
manga.thumbnail_url = "https:" + element.select("img").attr("src")
|
manga.thumbnail_url = "https://" + element.select("img").attr("data-original").replace("//", "")
|
||||||
|
// maybe the local cache cause the old source (url) can not be update. but the image can be update on detailpage.
|
||||||
|
// ps. new machine can be load img normal.
|
||||||
|
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,12 +85,12 @@ class wnacg : ParsedHttpSource() {
|
||||||
manga.author = document.select("div.uwuinfo p")?.first()?.text()?.trim() ?: "Unknown"
|
manga.author = document.select("div.uwuinfo p")?.first()?.text()?.trim() ?: "Unknown"
|
||||||
// val glist = document.select("a.tagshow").map { it?.text() }
|
// val glist = document.select("a.tagshow").map { it?.text() }
|
||||||
// manga.genre = glist.joinToString(", ")
|
// manga.genre = glist.joinToString(", ")
|
||||||
manga.thumbnail_url = "$baseUrl/" + document.select("div.uwthumb img").first().attr("src")
|
manga.thumbnail_url = "https://" + document.select("div.uwthumb img").first().attr("data-original").replace("//", "")
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val regex = "\\/\\/\\S*(jpg)".toRegex()
|
val regex = "\\/\\/\\S*(jpg|png)".toRegex()
|
||||||
val slideaid = client.newCall(GET(baseUrl + document.select("a.btn:containsOwn(下拉閱讀)").attr("href"), headers)).execute().asJsoup()
|
val slideaid = client.newCall(GET(baseUrl + document.select("a.btn:containsOwn(下拉閱讀)").attr("href"), headers)).execute().asJsoup()
|
||||||
val galleryaid = client.newCall(GET(baseUrl + slideaid.select("script[src$=html]").attr("src"), headers)).execute().asJsoup().toString()
|
val galleryaid = client.newCall(GET(baseUrl + slideaid.select("script[src$=html]").attr("src"), headers)).execute().asJsoup().toString()
|
||||||
val matchresult = regex.findAll(galleryaid).map { it.value }.toList()
|
val matchresult = regex.findAll(galleryaid).map { it.value }.toList()
|
||||||
|
@ -89,6 +100,7 @@ class wnacg : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element) = throw Exception("Not used")
|
override fun chapterFromElement(element: Element) = throw Exception("Not used")
|
||||||
override fun imageUrlRequest(page: Page) = throw Exception("Not used")
|
override fun imageUrlRequest(page: Page) = throw Exception("Not used")
|
||||||
override fun imageUrlParse(document: Document) = throw Exception("Not used")
|
override fun imageUrlParse(document: Document) = throw Exception("Not used")
|
||||||
|
|
Loading…
Reference in New Issue