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:
		
							parent
							
								
									e3b07d69a4
								
							
						
					
					
						commit
						918f2686eb
					
				@ -5,7 +5,7 @@ ext {
 | 
			
		||||
    extName = 'Ngomik'
 | 
			
		||||
    pkgNameSuffix = 'id.ngomik'
 | 
			
		||||
    extClass = '.Ngomik'
 | 
			
		||||
    extVersionCode = 3
 | 
			
		||||
    extVersionCode = 4
 | 
			
		||||
    libVersion = '1.2'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,16 +7,20 @@ 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.Request
 | 
			
		||||
import okhttp3.Response
 | 
			
		||||
import org.jsoup.nodes.Document
 | 
			
		||||
import org.jsoup.nodes.Element
 | 
			
		||||
import java.text.SimpleDateFormat
 | 
			
		||||
import java.util.Locale
 | 
			
		||||
 | 
			
		||||
class Ngomik : ParsedHttpSource() {
 | 
			
		||||
 | 
			
		||||
    override val name = "Ngomik"
 | 
			
		||||
 | 
			
		||||
    override val baseUrl = "https://ngomik.in"
 | 
			
		||||
    override val baseUrl = "https://ngomik.net"
 | 
			
		||||
 | 
			
		||||
    override val lang = "id"
 | 
			
		||||
 | 
			
		||||
@ -79,6 +83,21 @@ class Ngomik : ParsedHttpSource() {
 | 
			
		||||
 | 
			
		||||
    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 {
 | 
			
		||||
        setUrlWithoutDomain(element.attr("href"))
 | 
			
		||||
        name = element.text()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user