[Ru] Nudemoon fix baseUrl and cookie (#4495)

[Ru] Nudemoon fix baseUrl and cookie
This commit is contained in:
Pavka 2020-10-02 14:54:24 +03:00 committed by GitHub
parent 0e0d0c3a01
commit 99d12011a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Nude-Moon'
pkgNameSuffix = 'ru.nudemoon'
extClass = '.Nudemoon'
extVersionCode = 4
extVersionCode = 5
libVersion = '1.2'
containsNsfw = true
}

View File

@ -22,12 +22,34 @@ class Nudemoon : ParsedHttpSource() {
override val name = "Nude-Moon"
override val baseUrl = "https://nude-moon.net"
override val baseUrl = "https://nude-moon.me"
override val lang = "ru"
override val supportsLatest = true
private val cookiesHeader by lazy {
val cookies = mutableMapOf<String, String>()
cookies["NMfYa"] = "1"
buildCookies(cookies)
}
private fun buildCookies(cookies: Map<String, String>) =
cookies.entries.joinToString(separator = "; ", postfix = ";") {
"${URLEncoder.encode(it.key, "UTF-8")}=${URLEncoder.encode(it.value, "UTF-8")}"
}
override val client = network.client.newBuilder()
.addNetworkInterceptor { chain ->
val newReq = chain
.request()
.newBuilder()
.addHeader("Cookie", cookiesHeader)
.build()
chain.proceed(newReq)
}.build()!!
override fun popularMangaRequest(page: Int): Request =
GET("$baseUrl/all_manga?views&rowstart=${30 * (page - 1)}", headers)