Add MangaSwat Warning (#2184)
* Update build.gradle * Add warning to MangaSwat * Refactor sucuriCheck * Use addInterceptor * Update imports
This commit is contained in:
parent
ab7037fc8a
commit
95632f9978
@ -5,7 +5,7 @@ ext {
|
|||||||
appName = 'Tachiyomi: WP Manga Stream'
|
appName = 'Tachiyomi: WP Manga Stream'
|
||||||
pkgNameSuffix = 'all.wpmangastream'
|
pkgNameSuffix = 'all.wpmangastream'
|
||||||
extClass = '.WPMangaStreamFactory'
|
extClass = '.WPMangaStreamFactory'
|
||||||
extVersionCode = 4
|
extVersionCode = 5
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,7 @@ import eu.kanade.tachiyomi.source.Source
|
|||||||
import eu.kanade.tachiyomi.source.SourceFactory
|
import eu.kanade.tachiyomi.source.SourceFactory
|
||||||
import eu.kanade.tachiyomi.source.model.*
|
import eu.kanade.tachiyomi.source.model.*
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.*
|
||||||
import okhttp3.Request
|
|
||||||
import okhttp3.Response
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
@ -972,11 +970,20 @@ class MaidManga : WPMangaStream("Maid Manga (WP Manga Stream)", "https://www.mai
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
||||||
|
private class sucuri(): Interceptor {
|
||||||
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
|
val originalRequest = chain.request()
|
||||||
|
val response = chain.proceed(originalRequest)
|
||||||
|
if (response.headers().get("x-sucuri-cache").isNullOrEmpty()) throw Exception("Site protected, open webview | موقع محمي ، عرض ويب مفتوح")
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override val client: OkHttpClient = super.client.newBuilder().addInterceptor(sucuri()).build()
|
||||||
|
|
||||||
//Popular
|
//Popular
|
||||||
//Latest
|
//Latest
|
||||||
//Search
|
//Search
|
||||||
//Details
|
//Details
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||||
thumbnail_url = document.select("div.thumb img.lazyload").attr("data-src")
|
thumbnail_url = document.select("div.thumb img.lazyload").attr("data-src")
|
||||||
title = document.select("div.infox h1").text()
|
title = document.select("div.infox h1").text()
|
||||||
@ -990,20 +997,17 @@ class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
|||||||
artist = author
|
artist = author
|
||||||
description = document.select("div[itemprop=articleBody]").text()
|
description = document.select("div[itemprop=articleBody]").text()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Chapters
|
//Chapters
|
||||||
//Pages and Images
|
//Pages and Images
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
return GET(baseUrl + chapter.url + "?/", headers)
|
return GET(baseUrl + chapter.url + "?/", headers) //Bypass "linkvertise" ads
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||||
document.select("div#readerarea img[data-src]").forEachIndexed { index, element ->
|
document.select("div#readerarea img[data-src]").forEachIndexed { index, element ->
|
||||||
add(Page(index,"",element.attr("data-src")))
|
add(Page(index,"",element.attr("data-src")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageRequest(page: Page): Request {
|
override fun imageRequest(page: Page): Request {
|
||||||
return GET( page.imageUrl!! , headers)
|
return GET( page.imageUrl!! , headers)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user