fix & add latest chapter timestamp (#5129)
* fix latest chapter timestamp error when there is no chapter * add latest chapter timestamp to manhuaID
This commit is contained in:
parent
8ca71f5311
commit
df408c356a
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'WP MangaReader (multiple sources)'
|
||||
pkgNameSuffix = 'all.wpmangareader'
|
||||
extClass = '.WPMangaReaderFactory'
|
||||
extVersionCode = 1
|
||||
extVersionCode = 2
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ abstract class WPMangaReader(
|
|||
|
||||
// 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)
|
||||
val checkChapter = document.select(chapterListSelector()).firstOrNull()
|
||||
if (date != "" && checkChapter != null) chapters[0].date_upload = parseDate(date)
|
||||
|
||||
return chapters
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Comic Fx'
|
||||
pkgNameSuffix = 'id.comicfx'
|
||||
extClass = '.ComicFx'
|
||||
extVersionCode = 1
|
||||
extVersionCode = 2
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,8 @@ class ComicFx : ParsedHttpSource() {
|
|||
// Add timestamp to latest chapter, taken from "Updated On". so source which not provide chapter timestamp will have atleast one
|
||||
val updateOn = document.select(".infokomik .infolengkap span:contains(update) b").text()
|
||||
val date = document.select(".infokomik .infolengkap span:contains(update)").text().substringAfter(updateOn)
|
||||
if (date != "") chapters[0].date_upload = parseDate(date)
|
||||
val checkChapter = document.select(chapterListSelector()).firstOrNull()
|
||||
if (date != "" && checkChapter != null) chapters[0].date_upload = parseDate(date)
|
||||
|
||||
return chapters
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'ManhuaID'
|
||||
pkgNameSuffix = 'id.manhuaid'
|
||||
extClass = '.ManhuaID'
|
||||
extVersionCode = 2
|
||||
extVersionCode = 3
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,13 @@ import eu.kanade.tachiyomi.source.model.Page
|
|||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
class ManhuaID : ParsedHttpSource() {
|
||||
|
||||
|
@ -71,6 +75,22 @@ class ManhuaID : ParsedHttpSource() {
|
|||
|
||||
override fun chapterListSelector() = "table.table tr td:first-of-type 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("table tr:contains(update) td").text()
|
||||
val checkChapter = document.select(chapterListSelector()).firstOrNull()
|
||||
if (date != "" && checkChapter != null) chapters[0].date_upload = parseDate(date)
|
||||
|
||||
return chapters
|
||||
}
|
||||
|
||||
private fun parseDate(date: String): Long {
|
||||
return SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH).parse(date)?.time ?: 0L
|
||||
}
|
||||
|
||||
override fun chapterListRequest(manga: SManga) = GET(baseUrl + manga.url, headers)
|
||||
|
||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||
|
|
Loading…
Reference in New Issue