mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-25 19:52:56 +01:00
Madara, WPMangaThemesia: add CloudFlare lazy-load images parsing (#441)
* Madara, WPMangaThemesia: add CloudFlare lazy-load images parsing > The data-cfsrc is used by CloudFlare's Mirage feature to lazy-load images to improve website performance. * fix lint
This commit is contained in:
parent
72653d045d
commit
684209f9f1
@ -6,7 +6,6 @@ import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
|||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import org.jsoup.nodes.Element
|
|
||||||
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
|
||||||
@ -62,14 +61,4 @@ class LectorMangaLat : Madara(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val pageListParseSelector = "div.reading-content div.page-break > img"
|
override val pageListParseSelector = "div.reading-content div.page-break > img"
|
||||||
|
|
||||||
override fun imageFromElement(element: Element): String? {
|
|
||||||
return when {
|
|
||||||
element.hasAttr("data-cfsrc") -> element.attr("abs:data-cfsrc")
|
|
||||||
element.hasAttr("data-src") -> element.attr("abs:data-src")
|
|
||||||
element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src")
|
|
||||||
element.hasAttr("srcset") -> element.attr("abs:srcset").substringBefore(" ")
|
|
||||||
else -> element.attr("abs:src")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.extension.en.mangareadorg
|
package eu.kanade.tachiyomi.extension.en.mangareadorg
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||||
import org.jsoup.nodes.Element
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@ -10,14 +9,4 @@ class MangaReadOrg : Madara(
|
|||||||
"https://www.mangaread.org",
|
"https://www.mangaread.org",
|
||||||
"en",
|
"en",
|
||||||
SimpleDateFormat("dd.MM.yyy", Locale.US),
|
SimpleDateFormat("dd.MM.yyy", Locale.US),
|
||||||
) {
|
)
|
||||||
override fun imageFromElement(element: Element): String? {
|
|
||||||
return when {
|
|
||||||
element.hasAttr("data-cfsrc") -> element.attr("abs:data-cfsrc")
|
|
||||||
element.hasAttr("data-src") -> element.attr("abs:data-src")
|
|
||||||
element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src")
|
|
||||||
element.hasAttr("srcset") -> element.attr("abs:srcset").substringBefore(" ")
|
|
||||||
else -> element.attr("abs:src")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -18,7 +18,6 @@ import okhttp3.OkHttpClient
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
|
||||||
import rx.Observable
|
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
|
||||||
@ -115,13 +114,6 @@ class AsuraScans : MangaThemesia(
|
|||||||
.mapIndexed { i, img -> Page(i, document.location(), img.attr("abs:src")) }
|
.mapIndexed { i, img -> Page(i, document.location(), img.attr("abs:src")) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun Element.imgAttr(): String = when {
|
|
||||||
hasAttr("data-lazy-src") -> attr("abs:data-lazy-src")
|
|
||||||
hasAttr("data-src") -> attr("abs:data-src")
|
|
||||||
hasAttr("data-cfsrc") -> attr("abs:data-cfsrc")
|
|
||||||
else -> attr("abs:src")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Observable<MangasPage>.tempUrlToPermIfNeeded(): Observable<MangasPage> {
|
private fun Observable<MangasPage>.tempUrlToPermIfNeeded(): Observable<MangasPage> {
|
||||||
return this.map { mangasPage ->
|
return this.map { mangasPage ->
|
||||||
MangasPage(
|
MangasPage(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.extension.es.carteldemanhwas
|
package eu.kanade.tachiyomi.extension.es.carteldemanhwas
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||||
import org.jsoup.nodes.Element
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@ -15,13 +14,6 @@ class CarteldeManhwas : MangaThemesia(
|
|||||||
override val hasProjectPage = true
|
override val hasProjectPage = true
|
||||||
override val projectPageString = "/proyectos"
|
override val projectPageString = "/proyectos"
|
||||||
|
|
||||||
override fun Element.imgAttr(): String = when {
|
|
||||||
hasAttr("data-lazy-src") -> attr("abs:data-lazy-src")
|
|
||||||
hasAttr("data-cfsrc") -> attr("abs:data-cfsrc")
|
|
||||||
hasAttr("data-src") -> attr("abs:data-src")
|
|
||||||
else -> attr("abs:src")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun searchMangaSelector() = ".utao .uta .imgu:not(:has(span.novelabel)), " +
|
override fun searchMangaSelector() = ".utao .uta .imgu:not(:has(span.novelabel)), " +
|
||||||
".listupd .bs .bsx:not(:has(span.novelabel)), " +
|
".listupd .bs .bsx:not(:has(span.novelabel)), " +
|
||||||
".listo .bs .bsx:not(:has(span.novelabel))"
|
".listo .bs .bsx:not(:has(span.novelabel))"
|
||||||
|
@ -619,6 +619,7 @@ abstract class Madara(
|
|||||||
element.hasAttr("data-src") -> element.attr("abs:data-src")
|
element.hasAttr("data-src") -> element.attr("abs:data-src")
|
||||||
element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src")
|
element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src")
|
||||||
element.hasAttr("srcset") -> element.attr("abs:srcset").substringBefore(" ")
|
element.hasAttr("srcset") -> element.attr("abs:srcset").substringBefore(" ")
|
||||||
|
element.hasAttr("data-cfsrc") -> element.attr("abs:data-cfsrc")
|
||||||
else -> element.attr("abs:src")
|
else -> element.attr("abs:src")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
|||||||
|
|
||||||
override val themeClass = "Madara"
|
override val themeClass = "Madara"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 32
|
override val baseVersionCode: Int = 33
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1),
|
MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1),
|
||||||
|
@ -497,6 +497,7 @@ abstract class MangaThemesia(
|
|||||||
protected open fun Element.imgAttr(): String = when {
|
protected open fun Element.imgAttr(): String = when {
|
||||||
hasAttr("data-lazy-src") -> attr("abs:data-lazy-src")
|
hasAttr("data-lazy-src") -> attr("abs:data-lazy-src")
|
||||||
hasAttr("data-src") -> attr("abs:data-src")
|
hasAttr("data-src") -> attr("abs:data-src")
|
||||||
|
hasAttr("data-cfsrc") -> attr("abs:data-cfsrc")
|
||||||
else -> attr("abs:src")
|
else -> attr("abs:src")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
|||||||
|
|
||||||
override val themeClass = "MangaThemesia"
|
override val themeClass = "MangaThemesia"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 27
|
override val baseVersionCode: Int = 28
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("Miau Scan", "https://miaucomics.org", listOf("es", "pt-BR"), overrideVersionCode = 2),
|
MultiLang("Miau Scan", "https://miaucomics.org", listOf("es", "pt-BR"), overrideVersionCode = 2),
|
||||||
|
Loading…
Reference in New Issue
Block a user