+ Fix 403 TuMangaOnline on chapter images (#8816)
+ Update extVersionCode
This commit is contained in:
parent
fb91d67c36
commit
07463198d3
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'TuMangaOnline'
|
extName = 'TuMangaOnline'
|
||||||
pkgNameSuffix = 'es.tumangaonline'
|
pkgNameSuffix = 'es.tumangaonline'
|
||||||
extClass = '.TuMangaOnline'
|
extClass = '.TuMangaOnline'
|
||||||
extVersionCode = 34
|
extVersionCode = 35
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,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.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -38,6 +39,15 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
||||||
|
|
||||||
private val imageCDNUrl = "https://img1.japanreader.com"
|
private val imageCDNUrl = "https://img1.japanreader.com"
|
||||||
|
|
||||||
|
private val userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
|
||||||
|
"(KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
|
||||||
|
|
||||||
|
override fun headersBuilder(): Headers.Builder {
|
||||||
|
return Headers.Builder()
|
||||||
|
.add("User-Agent", userAgent)
|
||||||
|
.add("Referer", "$baseUrl/")
|
||||||
|
}
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
private val preferences: SharedPreferences by lazy {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
}
|
}
|
||||||
|
@ -167,6 +177,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
||||||
status.contains("Finalizado") -> SManga.COMPLETED
|
status.contains("Finalizado") -> SManga.COMPLETED
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
// One-shot
|
// One-shot
|
||||||
|
@ -244,8 +255,8 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Note: At this moment (15/02/2021) it's necessary to make the image request without headers to prevent 403.
|
// Note: At this moment (24/08/2021) it's necessary to make the image request with headers to prevent 403.
|
||||||
override fun imageRequest(page: Page) = GET(page.imageUrl!!)
|
override fun imageRequest(page: Page) = GET(page.imageUrl!!, headers)
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document): String {
|
override fun imageUrlParse(document: Document): String {
|
||||||
return document.select("div.viewer-container > div.img-container > img.viewer-image").attr("src")
|
return document.select("div.viewer-container > div.img-container > img.viewer-image").attr("src")
|
||||||
|
|
Loading…
Reference in New Issue