Remove Constellar Scans (#17277)

* Remove Constellar Scans

* Link to issue
This commit is contained in:
beerpsi 2023-07-27 23:53:16 +07:00 committed by GitHub
parent ab0d6aceab
commit 465ac1fce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 2 additions and 165 deletions

View File

@ -43,7 +43,7 @@ jobs:
},
{
"type": "both",
"regex": ".*(hq\\s*dragon|manga\\s*host|supermangas|superhentais|union\\s*mangas|yes\\s*mangas|manhuascan|manhwahot|leitor\\.?net|manga\\s*livre|tsuki\\s*mangas|manga\\s*yabu|mangas\\.in|mangas\\.pw|hentaikai|toptoon\\+?|colamanhua|mangadig|hitomi\\.la|copymanga|neox|1manga\\.co|mangafox\\.fun|mangahere\\.onl|mangakakalot\\.fun|manganel(?!o)|mangaonline\\.fun|mangatoday|manga\\.town|onemanga\\.info|koushoku|ksk\\.moe|comikey|leercapitulo|c[uứ]u\\s*truy[eệ]n|day\\s*comics?|reaper\\s*scans).*",
"regex": ".*(hq\\s*dragon|manga\\s*host|supermangas|superhentais|union\\s*mangas|yes\\s*mangas|manhuascan|manhwahot|leitor\\.?net|manga\\s*livre|tsuki\\s*mangas|manga\\s*yabu|mangas\\.in|mangas\\.pw|hentaikai|toptoon\\+?|colamanhua|mangadig|hitomi\\.la|copymanga|neox|1manga\\.co|mangafox\\.fun|mangahere\\.onl|mangakakalot\\.fun|manganel(?!o)|mangaonline\\.fun|mangatoday|manga\\.town|onemanga\\.info|koushoku|ksk\\.moe|comikey|leercapitulo|c[uứ]u\\s*truy[eệ]n|day\\s*comics?|reaper\\s*scans||constellar\\s*scans).*",
"ignoreCase": true,
"labels": ["invalid"],
"message": "{match} will not be added back as it is too difficult to maintain. Read #3475 for more information."

View File

@ -4,6 +4,7 @@
- ColaManhua (COLA漫画) https://github.com/tachiyomiorg/tachiyomi-extensions/pull/11445
- Comikey https://github.com/tachiyomiorg/tachiyomi-extensions/pull/11971
- Constellar Scans https://github.com/tachiyomiorg/tachiyomi-extensions/pull/17277
- CopyManga (拷贝漫画) https://github.com/tachiyomiorg/tachiyomi-extensions/pull/12376
- Cứu Truyện https://github.com/tachiyomiorg/tachiyomi-extensions/pull/16654
- Hentai Kai https://github.com/tachiyomiorg/tachiyomi-extensions/issues/9999

View File

@ -1,3 +0,0 @@
dependencies {
implementation(project(':lib-dataimage'))
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

View File

@ -1,160 +0,0 @@
package eu.kanade.tachiyomi.extension.en.constellarscans
import android.annotation.SuppressLint
import android.app.Application
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.View
import android.webkit.ConsoleMessage
import android.webkit.JavascriptInterface
import android.webkit.WebChromeClient
import android.webkit.WebView
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.lib.dataimage.DataImageInterceptor
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import okhttp3.CacheControl
import okhttp3.Headers
import okhttp3.Request
import org.jsoup.nodes.Document
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.CountDownLatch
class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarscans.com", "en") {
override val client = super.client.newBuilder()
.addInterceptor(DataImageInterceptor())
.rateLimit(1, 3)
.build()
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add("Referer", "$baseUrl/")
.add("Accept-Language", "en-US,en;q=0.9")
.add("DNT", "1")
.add("User-Agent", mobileUserAgent)
.add("Upgrade-Insecure-Requests", "1")
override val seriesStatusSelector = ".status"
private val mobileUserAgent by lazy {
val req = GET(UA_DB_URL)
val data = client.newCall(req).execute().body.use {
json.parseToJsonElement(it.string()).jsonArray
}.mapNotNull {
it.jsonObject["user-agent"]?.jsonPrimitive?.content?.takeIf { ua ->
ua.startsWith("Mozilla/5.0") &&
(
ua.contains("iPhone") &&
(ua.contains("FxiOS") || ua.contains("CriOS")) ||
ua.contains("Android") &&
(ua.contains("EdgA") || ua.contains("Chrome") || ua.contains("Firefox"))
)
}
}
data.random()
}
override fun pageListRequest(chapter: SChapter): Request =
super.pageListRequest(chapter).newBuilder()
.header(
"Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
)
.header("Sec-Fetch-Site", "same-origin")
.header("Sec-Fetch-Mode", "navigate")
.header("Sec-Fetch-Dest", "document")
.header("Sec-Fetch-User", "?1")
.cacheControl(CacheControl.FORCE_NETWORK)
.build()
internal class JsObject(val imageList: MutableList<String> = mutableListOf()) {
@JavascriptInterface
fun passSingleImage(url: String) {
Log.d("constellarscans", "received image: $url")
imageList.add(url)
}
}
private fun randomString(length: Int = 10): String {
val charPool = ('a'..'z') + ('A'..'Z')
return List(length) { charPool.random() }.joinToString("")
}
private val funkyScript by lazy {
client.newCall(GET(FUNKY_SCRIPT_URL)).execute().body.string()
}
@SuppressLint("SetJavaScriptEnabled")
override fun pageListParse(document: Document): List<Page> {
val interfaceName = randomString()
document.body().prepend("<script>${funkyScript.replace("\$interfaceName", interfaceName)}</script>")
val handler = Handler(Looper.getMainLooper())
val latch = CountDownLatch(1)
val jsInterface = JsObject()
var webView: WebView? = null
handler.post {
val webview = WebView(Injekt.get<Application>())
webView = webview
webview.settings.javaScriptEnabled = true
webview.settings.domStorageEnabled = true
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
webview.settings.useWideViewPort = false
webview.settings.loadWithOverviewMode = false
webview.settings.userAgentString = mobileUserAgent
webview.addJavascriptInterface(jsInterface, interfaceName)
webview.webChromeClient = object : WebChromeClient() {
override fun onProgressChanged(view: WebView?, newProgress: Int) {
if (newProgress == 100) {
latch.countDown()
}
}
override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
if (consoleMessage == null) { return false }
val logContent = "wv: ${consoleMessage.message()} ${consoleMessage.sourceId()}, line ${consoleMessage.lineNumber()}"
when (consoleMessage.messageLevel()) {
ConsoleMessage.MessageLevel.DEBUG -> Log.d("constellarscans", logContent)
ConsoleMessage.MessageLevel.ERROR -> Log.e("constellarscans", logContent)
ConsoleMessage.MessageLevel.LOG -> Log.i("constellarscans", logContent)
ConsoleMessage.MessageLevel.TIP -> Log.i("constellarscans", logContent)
ConsoleMessage.MessageLevel.WARNING -> Log.w("constellarscans", logContent)
else -> Log.d("constellarscans", logContent)
}
return true
}
}
Log.d("constellarscans", "starting webview shenanigans")
webview.loadDataWithBaseURL(baseUrl, document.toString(), "text/html", "UTF-8", null)
}
latch.await()
handler.post { webView?.destroy() }
return jsInterface.imageList.mapIndexed { idx, it -> Page(idx, imageUrl = it) }
}
override fun imageRequest(page: Page): Request = super.imageRequest(page).newBuilder()
.header("Accept", "image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8")
.header("Sec-Fetch-Dest", "image")
.header("Sec-Fetch-Mode", "no-cors")
.header("Sec-Fetch-Site", "same-origin")
.build()
override fun setupPreferenceScreen(screen: PreferenceScreen) { }
companion object {
const val UA_DB_URL =
"https://cdn.jsdelivr.net/gh/mimmi20/browscap-helper@30a83c095688f40b9eaca0165a479c661e5a7fbe/tests/0002999.json"
val FUNKY_SCRIPT_URL = "https://cdn.jsdelivr.net/npm/@beerpsi/funky-script@latest/constellar.js"
}
}

View File

@ -26,7 +26,6 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Boosei", "https://boosei.net", "id", overrideVersionCode = 2),
SingleLang("Babel Wuxia", "https://babelwuxia.com", "en", overrideVersionCode = 1),
SingleLang("Cartel de Manhwas", "https://carteldemanhwas.com", "es", overrideVersionCode = 5),
SingleLang("Constellar Scans", "https://constellarscans.com", "en", isNsfw = true, overrideVersionCode = 14),
SingleLang("Cosmic Scans", "https://cosmicscans.com", "en", overrideVersionCode = 1),
SingleLang("CosmicScans.id", "https://cosmicscans.id", "id", overrideVersionCode = 1, className = "CosmicScansID"),
SingleLang("Diskus Scan", "https://diskusscan.com", "pt-BR", overrideVersionCode = 7),