Fix missing chapters at MP (#8625)
* Fix missing chapters at MP. * Make rate limit more harsher.
This commit is contained in:
		
							parent
							
								
									00439cfd35
								
							
						
					
					
						commit
						eb255c0b78
					
				@ -18,9 +18,11 @@ class LeitorNet : MangasProject("Leitor.net", "https://leitor.net", "pt-BR") {
 | 
			
		||||
    override val id: Long = 2225174659569980836
 | 
			
		||||
 | 
			
		||||
    override val client: OkHttpClient = super.client.newBuilder()
 | 
			
		||||
        .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
 | 
			
		||||
        .addInterceptor(RateLimitInterceptor(1, 3, TimeUnit.SECONDS))
 | 
			
		||||
        .build()
 | 
			
		||||
 | 
			
		||||
    override val licensedCheck = true
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Temporary fix to bypass Cloudflare.
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@ class MangaLivre : MangasProject("Mangá Livre", "https://mangalivre.net", "pt-B
 | 
			
		||||
    override val id: Long = 4762777556012432014
 | 
			
		||||
 | 
			
		||||
    override val client: OkHttpClient = super.client.newBuilder()
 | 
			
		||||
        .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
 | 
			
		||||
        .addInterceptor(RateLimitInterceptor(1, 3, TimeUnit.SECONDS))
 | 
			
		||||
        .build()
 | 
			
		||||
 | 
			
		||||
    override fun popularMangaRequest(page: Int): Request {
 | 
			
		||||
 | 
			
		||||
@ -56,6 +56,8 @@ abstract class MangasProject(
 | 
			
		||||
 | 
			
		||||
    private val json: Json by injectLazy()
 | 
			
		||||
 | 
			
		||||
    protected open val licensedCheck: Boolean = false
 | 
			
		||||
 | 
			
		||||
    override fun popularMangaRequest(page: Int): Request {
 | 
			
		||||
        return GET("$baseUrl/home/most_read?page=$page&type=", sourceHeaders)
 | 
			
		||||
    }
 | 
			
		||||
@ -136,7 +138,7 @@ abstract class MangasProject(
 | 
			
		||||
        val isCompleted = seriesData.select("span.series-author i.complete-series").first() != null
 | 
			
		||||
 | 
			
		||||
        // Check if the manga was removed by the publisher.
 | 
			
		||||
        val seriesBlocked = document.select("div.series-blocked-img").first()
 | 
			
		||||
        val seriesBlocked = document.select("div.series-blocked-img:has(img[src$=blocked.svg])").first()
 | 
			
		||||
 | 
			
		||||
        val seriesAuthors = document.select("div#series-data span.series-author").text()
 | 
			
		||||
            .substringAfter("Completo")
 | 
			
		||||
@ -166,7 +168,7 @@ abstract class MangasProject(
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun parseStatus(seriesBlocked: Element?, isCompleted: Boolean) = when {
 | 
			
		||||
        seriesBlocked != null -> SManga.LICENSED
 | 
			
		||||
        seriesBlocked != null && licensedCheck -> SManga.LICENSED
 | 
			
		||||
        isCompleted -> SManga.COMPLETED
 | 
			
		||||
        else -> SManga.ONGOING
 | 
			
		||||
    }
 | 
			
		||||
@ -188,9 +190,9 @@ abstract class MangasProject(
 | 
			
		||||
 | 
			
		||||
    override fun chapterListParse(response: Response): List<SChapter> {
 | 
			
		||||
        val document = response.asJsoup()
 | 
			
		||||
        val licensedMessage = document.select("div.series-blocked-img").firstOrNull()
 | 
			
		||||
        val licensedMessage = document.select("div.series-blocked-img:has(img[src$=blocked.svg])").firstOrNull()
 | 
			
		||||
 | 
			
		||||
        if (licensedMessage != null) {
 | 
			
		||||
        if (licensedMessage != null && licensedCheck) {
 | 
			
		||||
            // If the manga is licensed and has been removed from the source,
 | 
			
		||||
            // the extension will not fetch the chapters, even if they are returned
 | 
			
		||||
            // by the API. This is just to mimic the website behavior.
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@ class MangasProjectGenerator : ThemeSourceGenerator {
 | 
			
		||||
 | 
			
		||||
    override val themeClass = "MangasProject"
 | 
			
		||||
 | 
			
		||||
    override val baseVersionCode: Int = 9
 | 
			
		||||
    override val baseVersionCode: Int = 10
 | 
			
		||||
 | 
			
		||||
    override val sources = listOf(
 | 
			
		||||
        SingleLang("Leitor.net", "https://leitor.net", "pt-BR", className = "LeitorNet", isNsfw = true),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user