9Hentai Fix Upload Date + Update Url (#7648)
* Update build.gradle * Update NineHentai.kt * Update NineHentai.kt
This commit is contained in:
parent
5a6f7b45d8
commit
b49b58613f
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'NineHentai'
|
extName = 'NineHentai'
|
||||||
pkgNameSuffix = 'all.ninehentai'
|
pkgNameSuffix = 'all.ninehentai'
|
||||||
extClass = '.NineHentai'
|
extClass = '.NineHentai'
|
||||||
extVersionCode = 10
|
extVersionCode = 11
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,12 @@ import okhttp3.Request
|
|||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import java.util.Date
|
import java.util.Calendar
|
||||||
|
|
||||||
@Nsfw
|
@Nsfw
|
||||||
class NineHentai : HttpSource() {
|
class NineHentai : HttpSource() {
|
||||||
|
|
||||||
override val baseUrl = "https://www1.9hentai.ru"
|
override val baseUrl = "https://9hentai.to"
|
||||||
|
|
||||||
override val name = "NineHentai"
|
override val name = "NineHentai"
|
||||||
|
|
||||||
@ -98,15 +98,48 @@ class NineHentai : HttpSource() {
|
|||||||
return mutableList
|
return mutableList
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val chapter = SChapter.create()
|
val document = response.asJsoup()
|
||||||
val chapterId = manga.url.substringAfter("/g/").toInt()
|
val time = document.select("div#info div time").text()
|
||||||
chapter.url = "/g/$chapterId"
|
return listOf(
|
||||||
chapter.name = "chapter"
|
SChapter.create().apply {
|
||||||
// api doesnt return date so setting to current date for now
|
name = "Chapter"
|
||||||
chapter.date_upload = Date().time
|
date_upload = parseChapterDate(time)
|
||||||
|
setUrlWithoutDomain(response.request.url.encodedPath)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return Observable.just(listOf(chapter))
|
private fun parseChapterDate(date: String): Long {
|
||||||
|
val value = date.split(' ')[0].toInt()
|
||||||
|
val timeStr = date.split(' ')[1].removeSuffix("s")
|
||||||
|
|
||||||
|
return when (timeStr) {
|
||||||
|
"sec" -> Calendar.getInstance().apply {
|
||||||
|
add(Calendar.SECOND, value * -1)
|
||||||
|
}.timeInMillis
|
||||||
|
"min" -> Calendar.getInstance().apply {
|
||||||
|
add(Calendar.MINUTE, value * -1)
|
||||||
|
}.timeInMillis
|
||||||
|
"hour" -> Calendar.getInstance().apply {
|
||||||
|
add(Calendar.HOUR_OF_DAY, value * -1)
|
||||||
|
}.timeInMillis
|
||||||
|
"day" -> Calendar.getInstance().apply {
|
||||||
|
add(Calendar.DATE, value * -1)
|
||||||
|
}.timeInMillis
|
||||||
|
"week" -> Calendar.getInstance().apply {
|
||||||
|
add(Calendar.DATE, value * 7 * -1)
|
||||||
|
}.timeInMillis
|
||||||
|
"month" -> Calendar.getInstance().apply {
|
||||||
|
add(Calendar.MONTH, value * -1)
|
||||||
|
}.timeInMillis
|
||||||
|
"year" -> Calendar.getInstance().apply {
|
||||||
|
add(Calendar.YEAR, value * -1)
|
||||||
|
}.timeInMillis
|
||||||
|
else -> {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
@ -211,8 +244,6 @@ class NineHentai : HttpSource() {
|
|||||||
|
|
||||||
override fun searchMangaParse(response: Response): MangasPage = throw Exception("Not Used")
|
override fun searchMangaParse(response: Response): MangasPage = throw Exception("Not Used")
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> = throw Exception("Not Used")
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val MEDIA_TYPE = "application/json; charset=utf-8".toMediaTypeOrNull()
|
private val MEDIA_TYPE = "application/json; charset=utf-8".toMediaTypeOrNull()
|
||||||
private const val SEARCH_URL = "/api/getBook"
|
private const val SEARCH_URL = "/api/getBook"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user