Fix wrong images in SS (#18499)

* Fix wrong images in SS.

* Undo visibility modifier change.
This commit is contained in:
Alessandro Jean 2023-10-11 23:07:33 -03:00 committed by GitHub
parent f56ae7f01e
commit 1196434448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 5 deletions

View File

@ -1,8 +1,11 @@
package eu.kanade.tachiyomi.extension.pt.ssshentais package eu.kanade.tachiyomi.extension.pt.ssshentais
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Page
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -17,4 +20,17 @@ class SssHentais : MangaThemesia(
override val client: OkHttpClient = super.client.newBuilder() override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS) .rateLimit(1, 2, TimeUnit.SECONDS)
.build() .build()
override fun imageRequest(page: Page): Request {
val newHeaders = headersBuilder()
.set("Referer", page.url)
.set("Accept", "image/avif,image/webp,*/*")
.set("Accept-Language", "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3")
.set("Sec-Fetch-Dest", "image")
.set("Sec-Fetch-Mode", "no-cors")
.set("Sec-Fetch-Site", "same-origin")
.build()
return GET(page.imageUrl!!, newHeaders)
}
} }

View File

@ -1,8 +1,11 @@
package eu.kanade.tachiyomi.extension.pt.sssscanlator package eu.kanade.tachiyomi.extension.pt.sssscanlator
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Page
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -17,4 +20,17 @@ class SSSScanlator : MangaThemesia(
override val client: OkHttpClient = super.client.newBuilder() override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS) .rateLimit(1, 2, TimeUnit.SECONDS)
.build() .build()
override fun imageRequest(page: Page): Request {
val newHeaders = headersBuilder()
.set("Referer", page.url)
.set("Accept", "image/avif,image/webp,*/*")
.set("Accept-Language", "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3")
.set("Sec-Fetch-Dest", "image")
.set("Sec-Fetch-Mode", "no-cors")
.set("Sec-Fetch-Site", "same-origin")
.build()
return GET(page.imageUrl!!, newHeaders)
}
} }

View File

@ -35,6 +35,7 @@ import rx.Observable
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.lang.IllegalArgumentException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -214,7 +215,6 @@ abstract class MangaThemesia(
listOf("ongoing", "publishing").any { this.contains(it, ignoreCase = true) } -> SManga.ONGOING listOf("ongoing", "publishing").any { this.contains(it, ignoreCase = true) } -> SManga.ONGOING
this.contains("hiatus", ignoreCase = true) -> SManga.ON_HIATUS this.contains("hiatus", ignoreCase = true) -> SManga.ON_HIATUS
this.contains("completed", ignoreCase = true) -> SManga.COMPLETED this.contains("completed", ignoreCase = true) -> SManga.COMPLETED
listOf("dropped", "cancelled").any { this.contains(it, ignoreCase = true) } -> SManga.CANCELLED
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
@ -263,9 +263,10 @@ abstract class MangaThemesia(
open val pageSelector = "div#readerarea img" open val pageSelector = "div#readerarea img"
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val chapterUrl = document.location()
val htmlPages = document.select(pageSelector) val htmlPages = document.select(pageSelector)
.filterNot { it.imgAttr().isEmpty() } .filterNot { it.imgAttr().isEmpty() }
.mapIndexed { i, img -> Page(i, "", img.imgAttr()) } .mapIndexed { i, img -> Page(i, chapterUrl, img.imgAttr()) }
countViews(document) countViews(document)
@ -280,12 +281,20 @@ abstract class MangaThemesia(
emptyList() emptyList()
} }
val scriptPages = imageList.mapIndexed { i, jsonEl -> val scriptPages = imageList.mapIndexed { i, jsonEl ->
Page(i, "", jsonEl.jsonPrimitive.content) Page(i, chapterUrl, jsonEl.jsonPrimitive.content)
} }
return scriptPages return scriptPages
} }
override fun imageRequest(page: Page): Request {
val newHeaders = headersBuilder()
.set("Referer", page.url)
.build()
return GET(page.imageUrl!!, newHeaders)
}
/** /**
* Set it to false if you want to disable the extension reporting the view count * Set it to false if you want to disable the extension reporting the view count
* back to the source website through admin-ajax.php. * back to the source website through admin-ajax.php.

View File

@ -126,8 +126,8 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("SkyMangas", "https://skymangas.com", "es"), SingleLang("SkyMangas", "https://skymangas.com", "es"),
SingleLang("Snudae Scans", "https://snudaescans.com", "en", isNsfw = true, className = "BatotoScans", overrideVersionCode = 1), SingleLang("Snudae Scans", "https://snudaescans.com", "en", isNsfw = true, className = "BatotoScans", overrideVersionCode = 1),
SingleLang("Soul Scans", "https://soulscans.my.id", "id", overrideVersionCode = 1), SingleLang("Soul Scans", "https://soulscans.my.id", "id", overrideVersionCode = 1),
SingleLang("SSSScanlator", "https://sssscanlator.com", "pt-BR"), SingleLang("SSSScanlator", "https://sssscanlator.com", "pt-BR", overrideVersionCode = 1),
SingleLang("SSS Hentais", "https://hentais.sssscanlator.com", "pt-BR", isNsfw = true, className = "SssHentais"), SingleLang("SSS Hentais", "https://hentais.sssscanlator.com", "pt-BR", isNsfw = true, className = "SssHentais", overrideVersionCode = 1),
SingleLang("Starlight Scan", "https://starligthscan.com", "pt-BR", isNsfw = true), SingleLang("Starlight Scan", "https://starligthscan.com", "pt-BR", isNsfw = true),
SingleLang("Summer Fansub", "https://smmr.in", "pt-BR", isNsfw = true), SingleLang("Summer Fansub", "https://smmr.in", "pt-BR", isNsfw = true),
SingleLang("SummerToon", "https://summertoon.com", "tr"), SingleLang("SummerToon", "https://summertoon.com", "tr"),