Update Ngomik (#5003)

* Update baseUrl

* add timestamp to latest chapter

Add timestamp to latest chapter, taken from "Updated On". so source which not provide chapter timestamp will have atleast one

* update ext version
This commit is contained in:
Riztard Lanthorn 2020-12-03 21:42:31 +07:00 committed by GitHub
parent e3b07d69a4
commit 918f2686eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Ngomik' extName = 'Ngomik'
pkgNameSuffix = 'id.ngomik' pkgNameSuffix = 'id.ngomik'
extClass = '.Ngomik' extClass = '.Ngomik'
extVersionCode = 3 extVersionCode = 4
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -7,16 +7,20 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.Response
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.util.Locale
class Ngomik : ParsedHttpSource() { class Ngomik : ParsedHttpSource() {
override val name = "Ngomik" override val name = "Ngomik"
override val baseUrl = "https://ngomik.in" override val baseUrl = "https://ngomik.net"
override val lang = "id" override val lang = "id"
@ -79,6 +83,21 @@ class Ngomik : ParsedHttpSource() {
override fun chapterListSelector() = "div.lch > a" override fun chapterListSelector() = "div.lch > a"
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val chapters = document.select(chapterListSelector()).map { chapterFromElement(it) }
// Add timestamp to latest chapter, taken from "Updated On". so source which not provide chapter timestamp will have atleast one
val date = document.select(".listinfo li:contains(update) time").attr("datetime")
if (date != "") chapters[0].date_upload = parseDate(date)
return chapters
}
private fun parseDate(date: String): Long {
return SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(date)?.time ?: 0L
}
override fun chapterFromElement(element: Element) = SChapter.create().apply { override fun chapterFromElement(element: Element) = SChapter.create().apply {
setUrlWithoutDomain(element.attr("href")) setUrlWithoutDomain(element.attr("href"))
name = element.text() name = element.text()