parent
61409c94b2
commit
4bb19c8456
|
@ -5,7 +5,7 @@ ext {
|
|||
appName = 'Tachiyomi: Mangahasu'
|
||||
pkgNameSuffix = 'en.mangahasu'
|
||||
extClass = '.Mangahasu'
|
||||
extVersionCode = 6
|
||||
extVersionCode = 7
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package eu.kanade.tachiyomi.extension.en.mangahasu
|
||||
|
||||
import android.util.Base64
|
||||
import com.github.salomonbrys.kotson.*
|
||||
import com.github.salomonbrys.kotson.array
|
||||
import com.github.salomonbrys.kotson.get
|
||||
import com.github.salomonbrys.kotson.int
|
||||
import com.github.salomonbrys.kotson.string
|
||||
import com.google.gson.JsonParser
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
|
@ -15,7 +18,7 @@ import okhttp3.Request
|
|||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
|
||||
class Mangahasu : ParsedHttpSource() {
|
||||
|
||||
|
@ -29,6 +32,10 @@ class Mangahasu: ParsedHttpSource() {
|
|||
|
||||
override val client: OkHttpClient = network.cloudflareClient
|
||||
|
||||
override fun headersBuilder(): Headers.Builder {
|
||||
return super.headersBuilder().add("Referer", baseUrl)
|
||||
}
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request =
|
||||
GET("$baseUrl/directory.html?page=$page", headers)
|
||||
|
||||
|
@ -57,7 +64,10 @@ class Mangahasu: ParsedHttpSource() {
|
|||
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
return GET("$baseUrl/advanced-search.html?keyword=$query&author=&artist=&status=&typeid=&page=$page", headers)
|
||||
return GET(
|
||||
"$baseUrl/advanced-search.html?keyword=$query&author=&artist=&status=&typeid=&page=$page",
|
||||
headers
|
||||
)
|
||||
}
|
||||
|
||||
override fun searchMangaSelector() =
|
||||
|
@ -98,7 +108,7 @@ class Mangahasu: ParsedHttpSource() {
|
|||
chapter.name = urlElement.text()
|
||||
|
||||
chapter.date_upload = element.select(".date-updated").last()?.text()?.let {
|
||||
SimpleDateFormat("MMM dd, yyyy", Locale.US).parse(it).time
|
||||
SimpleDateFormat("MMM dd, yyyy", Locale.US).parse(it)?.time ?: 0
|
||||
} ?: 0
|
||||
return chapter
|
||||
}
|
||||
|
@ -129,7 +139,9 @@ class Mangahasu: ParsedHttpSource() {
|
|||
//Some images are not yet loaded onto Mangahasu's image server.
|
||||
//Decode temporary URLs and replace placeholder images.
|
||||
|
||||
val lstDUrls = document.select("script:containsData(lstDUrls)").html().substringAfter("lstDUrls").substringAfter("\"").substringBefore("\"")
|
||||
val lstDUrls =
|
||||
document.select("script:containsData(lstDUrls)").html().substringAfter("lstDUrls")
|
||||
.substringAfter("\"").substringBefore("\"")
|
||||
if (lstDUrls != "W10=") { //Base64 = [] or empty file
|
||||
val decoded = String(Base64.decode(lstDUrls, Base64.DEFAULT))
|
||||
val json = JsonParser().parse(decoded).array
|
||||
|
@ -144,12 +156,4 @@ class Mangahasu: ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun imageUrlParse(document: Document) = ""
|
||||
|
||||
override fun imageRequest(page: Page): Request {
|
||||
val imgHeader = headers.newBuilder().apply {
|
||||
add("Referer", baseUrl)
|
||||
}.build()
|
||||
return GET(page.imageUrl!!, imgHeader)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue