parent
61409c94b2
commit
4bb19c8456
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Mangahasu'
|
appName = 'Tachiyomi: Mangahasu'
|
||||||
pkgNameSuffix = 'en.mangahasu'
|
pkgNameSuffix = 'en.mangahasu'
|
||||||
extClass = '.Mangahasu'
|
extClass = '.Mangahasu'
|
||||||
extVersionCode = 6
|
extVersionCode = 7
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.mangahasu
|
package eu.kanade.tachiyomi.extension.en.mangahasu
|
||||||
|
|
||||||
import android.util.Base64
|
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 com.google.gson.JsonParser
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
@ -15,7 +18,7 @@ import okhttp3.Request
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.Locale
|
||||||
|
|
||||||
class Mangahasu : ParsedHttpSource() {
|
class Mangahasu : ParsedHttpSource() {
|
||||||
|
|
||||||
|
@ -29,6 +32,10 @@ class Mangahasu: ParsedHttpSource() {
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
override val client: OkHttpClient = network.cloudflareClient
|
||||||
|
|
||||||
|
override fun headersBuilder(): Headers.Builder {
|
||||||
|
return super.headersBuilder().add("Referer", baseUrl)
|
||||||
|
}
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request =
|
override fun popularMangaRequest(page: Int): Request =
|
||||||
GET("$baseUrl/directory.html?page=$page", headers)
|
GET("$baseUrl/directory.html?page=$page", headers)
|
||||||
|
|
||||||
|
@ -57,7 +64,10 @@ class Mangahasu: ParsedHttpSource() {
|
||||||
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
|
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
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() =
|
override fun searchMangaSelector() =
|
||||||
|
@ -98,7 +108,7 @@ class Mangahasu: ParsedHttpSource() {
|
||||||
chapter.name = urlElement.text()
|
chapter.name = urlElement.text()
|
||||||
|
|
||||||
chapter.date_upload = element.select(".date-updated").last()?.text()?.let {
|
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
|
} ?: 0
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
@ -129,7 +139,9 @@ class Mangahasu: ParsedHttpSource() {
|
||||||
//Some images are not yet loaded onto Mangahasu's image server.
|
//Some images are not yet loaded onto Mangahasu's image server.
|
||||||
//Decode temporary URLs and replace placeholder images.
|
//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
|
if (lstDUrls != "W10=") { //Base64 = [] or empty file
|
||||||
val decoded = String(Base64.decode(lstDUrls, Base64.DEFAULT))
|
val decoded = String(Base64.decode(lstDUrls, Base64.DEFAULT))
|
||||||
val json = JsonParser().parse(decoded).array
|
val json = JsonParser().parse(decoded).array
|
||||||
|
@ -144,12 +156,4 @@ class Mangahasu: ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = ""
|
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