Mangafoxfix Closes #15469 (#15689)

* revert some eff7f06  changes 

still keeping the cookiestuff

* Update build.gradle

* remove commented out code

* Revert indentation changes. and readd back comma
This commit is contained in:
Kevin 2023-03-14 02:36:07 +08:00 committed by GitHub
parent 8a623f9855
commit 09c23fd1b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 27 deletions

View File

@ -6,12 +6,9 @@ ext {
extName = 'MangaFox' extName = 'MangaFox'
pkgNameSuffix = 'en.mangafox' pkgNameSuffix = 'en.mangafox'
extClass = '.MangaFox' extClass = '.MangaFox'
extVersionCode = 6 extVersionCode = 7
isNsfw = true isNsfw = true
} }
dependencies {
implementation(project(":lib-unpacker"))
}
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.extension.en.mangafox package eu.kanade.tachiyomi.extension.en.mangafox
import android.webkit.CookieManager import android.webkit.CookieManager
import eu.kanade.tachiyomi.lib.unpacker.Unpacker
import eu.kanade.tachiyomi.network.GET 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.Filter import eu.kanade.tachiyomi.source.model.Filter
@ -21,8 +20,8 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Calendar import java.util.Calendar
import java.util.Locale import java.util.Locale
@ -43,7 +42,7 @@ class MangaFox : ParsedHttpSource() {
override val client: OkHttpClient = network.cloudflareClient.newBuilder() override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.rateLimit(1, 1) .rateLimit(1, 1)
// Force readway=2 cookie to get all page URLs at once // Force readway=2 cookie to get all page URLs at once
.cookieJar( .cookieJar(
object : CookieJar { object : CookieJar {
private val cookieManager by lazy { CookieManager.getInstance() } private val cookieManager by lazy { CookieManager.getInstance() }
@ -188,27 +187,17 @@ class MangaFox : ParsedHttpSource() {
} }
override fun pageListRequest(chapter: SChapter): Request { override fun pageListRequest(chapter: SChapter): Request {
val headers = headersBuilder() val mobilePath = chapter.url.replace("/manga/", "/roll_manga/")
.set("Referer", "$mobileUrl/")
.build() val headers = headersBuilder().set("Referer", "$mobileUrl/").build()
return GET("$mobileUrl${chapter.url}", headers)
return GET("$mobileUrl$mobilePath", headers)
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> =
val packed = document.selectFirst("script:containsData(p,a,c,k,e)")!!.data() document.select("#viewer img").mapIndexed { idx, it ->
val imagesRaw = Unpacker.unpack(packed) Page(idx, imageUrl = it.attr("abs:data-original"))
.substringAfter("newImgs=")
.substringBefore(";")
return json.parseToJsonElement(imagesRaw).jsonArray.mapIndexed { idx, it ->
val rawImageUrl = it.jsonPrimitive.content
val imageUrl = if (rawImageUrl.startsWith("http")) {
rawImageUrl
} else {
"${mobileUrl.substringBefore("://")}:$rawImageUrl"
}
Page(idx, imageUrl = imageUrl)
} }
}
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
@ -296,7 +285,7 @@ class MangaFox : ParsedHttpSource() {
Pair("3 stars", "3"), Pair("3 stars", "3"),
Pair("4 stars", "4"), Pair("4 stars", "4"),
Pair("5 stars", "5"), Pair("5 stars", "5"),
), )
) )
private class RatingFilter : Filter.Group<UriPartFilter>("Rating", listOf(RatingMethodFilter(), RatingValueFilter())) private class RatingFilter : Filter.Group<UriPartFilter>("Rating", listOf(RatingMethodFilter(), RatingValueFilter()))