MangaThemesia: referer shenanigans (#18534)

* MangaThemesia: header shenanigan

* undo SushiScan, see https://github.com/tachiyomiorg/tachiyomi-extensions/pull/18527
This commit is contained in:
AwkwardPeak7 2023-10-13 22:13:19 +05:00 committed by GitHub
parent 691bf0030c
commit a751a95640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 31 additions and 52 deletions

View File

@ -112,7 +112,7 @@ class AsuraScansEn : MangaThemesia(
override fun pageListParse(document: Document): List<Page> {
return document.select(pageSelector)
.filterNot { it.attr("src").isNullOrEmpty() }
.mapIndexed { i, img -> Page(i, "", img.attr("abs:src")) }
.mapIndexed { i, img -> Page(i, document.location(), img.attr("abs:src")) }
}
override fun Element.imgAttr(): String = when {

View File

@ -50,7 +50,7 @@ class AsuraScansTr : MangaThemesia(
val jsonString = scriptContent.substringAfter("ts_reader.run(").substringBefore(");")
val tsReader = json.decodeFromString<TSReader>(jsonString)
val imageUrls = tsReader.sources.firstOrNull()?.images ?: return emptyList()
return imageUrls.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) }
return imageUrls.mapIndexed { index, imageUrl -> Page(index, document.location(), imageUrl) }
}
@Serializable

View File

@ -76,7 +76,7 @@ open class FlameScans(
val imageUrls = el.select("img")
.joinToString("|") { it.attr("abs:src") }
Page(i, "", imageUrls + COMPOSED_SUFFIX)
Page(i, document.location(), imageUrls + COMPOSED_SUFFIX)
}
}
}

View File

@ -32,7 +32,6 @@ class KomikCast : MangaThemesia("Komik Cast", "https://komikcast.vip", "id", "/d
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
.add("Accept-language", "en-US,en;q=0.9,id;q=0.8")
.add("Referer", baseUrl)
override fun imageRequest(page: Page): Request {
val newHeaders = headersBuilder()
@ -159,7 +158,7 @@ class KomikCast : MangaThemesia("Komik Cast", "https://komikcast.vip", "id", "/d
}
return doc.select(cssQuery)
.mapIndexed { i, img -> Page(i, "", img.imgAttr()) }
.mapIndexed { i, img -> Page(i, document.location(), img.imgAttr()) }
}
override val hasProjectPage: Boolean = true

View File

@ -21,9 +21,6 @@ class LunarScans : MangaThemesia(
.rateLimit(1)
.build()
override fun headersBuilder() = super.headersBuilder()
.add("Referer", "$baseUrl/")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return if (query.isEmpty()) {
super.searchMangaRequest(page, query, filters)
@ -61,7 +58,7 @@ class LunarScans : MangaThemesia(
val jsonString = scriptContent.substringAfter("ts_reader.run(").substringBefore(");")
val tsReader = json.decodeFromString<TSReader>(jsonString)
val imageUrls = tsReader.sources.firstOrNull()?.images ?: return emptyList()
return imageUrls.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) }
return imageUrls.mapIndexed { index, imageUrl -> Page(index, document.location(), imageUrl) }
}
@Serializable

View File

@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
@ -24,7 +23,7 @@ import java.util.Locale
class MangaSwat : MangaThemesia(
"MangaSwat",
"https://stmgs.com",
"https://goldragon.me",
"ar",
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("ar")),
) {
@ -40,9 +39,6 @@ class MangaSwat : MangaThemesia(
.rateLimit(1)
.build()
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.add("Referer", "$baseUrl/")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val request = super.searchMangaRequest(page, query, filters)
if (query.isBlank()) return request
@ -71,7 +67,7 @@ class MangaSwat : MangaThemesia(
val jsonString = scriptContent.substringAfter("ts_reader.run(").substringBefore(");")
val tsReader = json.decodeFromString<TSReader>(jsonString)
val imageUrls = tsReader.sources.firstOrNull()?.images ?: return emptyList()
return imageUrls.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) }
return imageUrls.mapIndexed { index, imageUrl -> Page(index, document.location(), imageUrl) }
}
override fun chapterListSelector() = "div.bxcl li, ul div:has(span.lchx)"

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.extension.id.manhwaindo
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import okhttp3.Headers
import java.text.SimpleDateFormat
import java.util.Locale
@ -12,10 +11,6 @@ class ManhwaIndo : MangaThemesia(
"/series",
SimpleDateFormat("MMMM dd, yyyy", Locale.US),
) {
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.add("Referer", baseUrl)
override val seriesTitleSelector = ".ts-breadcrumb li:last-child span"
override val hasProjectPage = true

View File

@ -33,7 +33,7 @@ class Nekomik : MangaThemesia("Nekomik", "https://nekomik.me", "id") {
val tsReader = json.decodeFromString<TSReader>(data)
val imageUrls = tsReader.sources.firstOrNull()?.images ?: return emptyList()
return imageUrls.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) }
return imageUrls.mapIndexed { index, imageUrl -> Page(index, document.location(), imageUrl) }
}
@Serializable

View File

@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.extension.en.nightscans
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.Headers
import okhttp3.OkHttpClient
import java.util.concurrent.TimeUnit
@ -11,7 +10,4 @@ class NightScans : MangaThemesia("NIGHT SCANS", "https://nightscans.net", "en",
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(20, 4, TimeUnit.SECONDS)
.build()
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.add("Referer", baseUrl)
}

View File

@ -34,7 +34,7 @@ class SkyMangas : MangaThemesia(
}
return imageList.mapIndexed { i, jsonEl ->
Page(i, "", jsonEl.jsonPrimitive.content)
Page(i, document.location(), jsonEl.jsonPrimitive.content)
}
}

View File

@ -4,7 +4,9 @@ import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import java.text.SimpleDateFormat
import java.util.Locale
class UzayManga : MangaThemesia("Uzay Manga", "https://uzaymanga.com", "tr", dateFormat = SimpleDateFormat("MMM d, yyyy", Locale("tr"))) {
override fun headersBuilder() = super.headersBuilder()
.add("referer", "$baseUrl/")
}
class UzayManga : MangaThemesia(
"Uzay Manga",
"https://uzaymanga.com",
"tr",
dateFormat = SimpleDateFormat("MMM d, yyyy", Locale("tr")),
)

View File

@ -66,7 +66,7 @@ class VexManga : MangaThemesia(
emptyList()
}
val scriptPages = imageList.mapIndexed { i, jsonEl ->
Page(i, "", jsonEl.jsonPrimitive.content)
Page(i, document.location(), jsonEl.jsonPrimitive.content)
}
return scriptPages

View File

@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.extension.id.worldromancetranslation
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.Headers
import org.jsoup.nodes.Document
import java.text.SimpleDateFormat
import java.util.Locale
@ -17,10 +16,6 @@ class WorldRomanceTranslation : MangaThemesia(
override val hasProjectPage = true
override fun headersBuilder(): Headers.Builder {
return super.headersBuilder().add("Referer", baseUrl)
}
override fun mangaDetailsParse(document: Document): SManga {
val thumbnail = document.select(seriesThumbnailSelector)

View File

@ -40,7 +40,7 @@ class xCaliBRScans : MangaThemesia("xCaliBR Scans", "https://xcalibrscans.com",
}
}
return imgUrls.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) }
return imgUrls.mapIndexed { index, imageUrl -> Page(index, document.location(), imageUrl) }
}
private fun parseAntiScrapScramble(element: Element, destination: MutableList<String>) {

View File

@ -22,7 +22,6 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonPrimitive
import okhttp3.FormBody
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
@ -69,7 +68,7 @@ abstract class MangaThemesia(
.build()
}
override fun headersBuilder(): Headers.Builder = Headers.Builder()
override fun headersBuilder() = super.headersBuilder()
.set("Referer", "$baseUrl/")
open val projectPageString = "/project"

View File

@ -14,8 +14,8 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 27
override val sources = listOf(
MultiLang("Asura Scans", "https://asuratoon.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 30),
MultiLang("Flame Scans", "https://flamescans.org", listOf("en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 4),
MultiLang("Asura Scans", "https://asuratoon.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 31),
MultiLang("Flame Scans", "https://flamescans.org", listOf("en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 5),
MultiLang("Miau Scan", "https://miauscans.com", listOf("es", "pt-BR"), overrideVersionCode = 1),
SingleLang("Alceascan", "https://alceascan.my.id", "id"),
SingleLang("Animated Glitched Scans", "https://anigliscans.xyz", "en", overrideVersionCode = 1),
@ -52,7 +52,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Komiksan", "https://komiksan.link", "id", overrideVersionCode = 2),
SingleLang("Kiryuu", "https://kiryuu.id", "id", overrideVersionCode = 6),
SingleLang("Komik AV", "https://komikav.com", "id", overrideVersionCode = 1),
SingleLang("Komik Cast", "https://komikcast.vip", "id", overrideVersionCode = 22),
SingleLang("Komik Cast", "https://komikcast.vip", "id", overrideVersionCode = 23),
SingleLang("KomikDewasa", "https://komikdewasa.org", "id", isNsfw = true),
SingleLang("Komik Station", "https://komikstation.co", "id", overrideVersionCode = 4),
SingleLang("KomikIndo.co", "https://komikindo.co", "id", className = "KomikindoCo", overrideVersionCode = 3),
@ -66,7 +66,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Legion Scan", "https://legionscans.com", "es", overrideVersionCode = 6),
SingleLang("Lelmanga", "https://www.lelmanga.com", "fr"),
SingleLang("LianScans", "https://www.lianscans.my.id", "id", isNsfw = true),
SingleLang("Lunar Scans", "https://lunarscan.org", "en", isNsfw = true),
SingleLang("Lunar Scans", "https://lunarscan.org", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("LynxScans", "https://lynxscans.com", "en"),
SingleLang("Lyra Scans", "https://lyrascans.com", "en"),
SingleLang("Magus Manga", "https://magusmanga.com", "ar"),
@ -81,13 +81,13 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("MangaWT", "https://mangawt.com", "tr", overrideVersionCode = 5),
SingleLang("Mangayaro", "https://mangayaro.net", "id"),
SingleLang("Manhwa Lover", "https://manhwalover.com", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("MangaSwat", "https://swatmanga.co", "ar", overrideVersionCode = 13),
SingleLang("MangaSwat", "https://goldragon.me", "ar", overrideVersionCode = 14),
SingleLang("MangKomik", "https://mangkomik.net", "id", overrideVersionCode = 1),
SingleLang("Mangás Chan", "https://mangaschan.net", "pt-BR", className = "MangasChan", overrideVersionCode = 1),
SingleLang("Manhwa Freak", "https://manhwa-freak.com", "en", overrideVersionCode = 3),
SingleLang("ManhwaFreak", "https://manhwafreak.fr", "fr", className = "ManhwaFreakFR"),
SingleLang("ManhwaDesu", "https://manhwadesu.one", "id", isNsfw = true, overrideVersionCode = 4),
SingleLang("ManhwaIndo", "https://manhwaindo.id", "id", isNsfw = true, overrideVersionCode = 3),
SingleLang("ManhwaIndo", "https://manhwaindo.id", "id", isNsfw = true, overrideVersionCode = 4),
SingleLang("ManhwaLand.mom", "https://manhwaland.lat", "id", isNsfw = true, className = "ManhwaLandMom", overrideVersionCode = 5),
SingleLang("ManhwaList", "https://manhwalist.com", "id", overrideVersionCode = 4),
SingleLang("Manhwax", "https://manhwax.com", "en", isNsfw = true),
@ -98,9 +98,9 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("MirrorDesu", "https://mirrordesu.me", "id", isNsfw = true),
SingleLang("Moon Daisy Scans", "https://moondaisyscans.com", "tr", isNsfw = true),
SingleLang("Mundo Mangá-Kun", "https://mundomangakun.com.br", "pt-BR", className = "MundoMangaKun", isNsfw = true),
SingleLang("Nekomik", "https://nekomik.me", "id", overrideVersionCode = 1),
SingleLang("Nekomik", "https://nekomik.me", "id", overrideVersionCode = 2),
SingleLang("Ngomik", "https://ngomik.net", "id", overrideVersionCode = 2),
SingleLang("NIGHT SCANS", "https://nightscans.net", "en", isNsfw = true, className = "NightScans", overrideVersionCode = 2),
SingleLang("NIGHT SCANS", "https://nightscans.net", "en", isNsfw = true, className = "NightScans", overrideVersionCode = 3),
SingleLang("Nocturnal Scans", "https://nocturnalscans.com", "en", overrideVersionCode = 1),
SingleLang("Noromax", "https://noromax.my.id", "id"),
SingleLang("OPSCANS", "https://opscans.com", "all"),
@ -123,7 +123,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Shadow Mangas", "https://shadowmangas.com", "es", overrideVersionCode = 1),
SingleLang("Shea Manga", "https://sheakomik.com", "id", overrideVersionCode = 4),
SingleLang("Silence Scan", "https://silencescan.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 5),
SingleLang("SkyMangas", "https://skymangas.com", "es"),
SingleLang("SkyMangas", "https://skymangas.com", "es", 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("SSSScanlator", "https://sssscanlator.com", "pt-BR", overrideVersionCode = 1),
@ -142,16 +142,16 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Tsundoku Traduções", "https://tsundoku.com.br", "pt-BR", className = "TsundokuTraducoes", overrideVersionCode = 9),
SingleLang("TukangKomik", "https://tukangkomik.id", "id", overrideVersionCode = 1),
SingleLang("TurkToon", "https://turktoon.com", "tr"),
SingleLang("Uzay Manga", "https://uzaymanga.com", "tr", overrideVersionCode = 5),
SingleLang("Uzay Manga", "https://uzaymanga.com", "tr", overrideVersionCode = 6),
SingleLang("Walpurgi Scan", "https://www.walpurgiscan.com", "it", overrideVersionCode = 6, className = "WalpurgisScan", pkgName = "walpurgisscan"),
SingleLang("West Manga", "https://westmanga.info", "id", overrideVersionCode = 1),
SingleLang("World Romance Translation", "https://wrt.my.id", "id", overrideVersionCode = 10),
SingleLang("xCaliBR Scans", "https://xcalibrscans.com", "en", overrideVersionCode = 4),
SingleLang("World Romance Translation", "https://wrt.my.id", "id", overrideVersionCode = 11),
SingleLang("xCaliBR Scans", "https://xcalibrscans.com", "en", overrideVersionCode = 5),
SingleLang("YumeKomik", "https://yumekomik.com", "id", isNsfw = true, className = "YumeKomik", pkgName = "inazumanga", overrideVersionCode = 6),
SingleLang("Zahard", "https://zahard.xyz", "en"),
SingleLang("สดใสเมะ", "https://www.xn--l3c0azab5a2gta.com", "th", isNsfw = true, className = "Sodsaime", overrideVersionCode = 1),
SingleLang("أريا مانجا", "https://www.areascans.net", "ar", className = "AreaManga"),
SingleLang("فيكس مانجا", "https://vexmanga.net", "ar", className = "VexManga"),
SingleLang("فيكس مانجا", "https://vexmanga.net", "ar", className = "VexManga", overrideVersionCode = 1),
)
companion object {