TruyenGG, TruyenQQ: Fix http 429 manga update (#6354)

* Fix http 429 manga update error TruyenGG

* Fix http 429 manga update error TruyenQQ

* Update TruyenQQ.kt

* Update TruyenQQ.kt
This commit is contained in:
are-are-are 2024-11-28 04:06:37 +07:00 committed by Draff
parent 050efe196b
commit 91b673efbb
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
4 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'TruyenGG' extName = 'TruyenGG'
extClass = '.TruyenGG' extClass = '.TruyenGG'
extVersionCode = 2 extVersionCode = 3
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -25,6 +25,7 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit
class TruyenGG : ParsedHttpSource(), ConfigurableSource { class TruyenGG : ParsedHttpSource(), ConfigurableSource {
@ -39,7 +40,7 @@ class TruyenGG : ParsedHttpSource(), ConfigurableSource {
override val baseUrl by lazy { getPrefBaseUrl() } override val baseUrl by lazy { getPrefBaseUrl() }
override val client: OkHttpClient = network.cloudflareClient.newBuilder() override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.rateLimit(1) .rateLimit(1, 2, TimeUnit.SECONDS)
.build() .build()
override fun headersBuilder(): Headers.Builder = override fun headersBuilder(): Headers.Builder =

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'TruyenQQ' extName = 'TruyenQQ'
extClass = '.TruyenQQ' extClass = '.TruyenQQ'
extVersionCode = 15 extVersionCode = 16
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.extension.vi.truyenqq package eu.kanade.tachiyomi.extension.vi.truyenqq
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
@ -31,10 +32,7 @@ class TruyenQQ : ParsedHttpSource() {
override val supportsLatest: Boolean = true override val supportsLatest: Boolean = true
override val client: OkHttpClient = network.cloudflareClient.newBuilder() override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.connectTimeout(30, TimeUnit.SECONDS) .rateLimit(1, 2, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.retryOnConnectionFailure(true)
.followRedirects(true)
.build() .build()
override fun headersBuilder(): Headers.Builder = override fun headersBuilder(): Headers.Builder =
@ -53,7 +51,7 @@ class TruyenQQ : ParsedHttpSource() {
val anchor = element.selectFirst(".book_info .qtip a")!! val anchor = element.selectFirst(".book_info .qtip a")!!
setUrlWithoutDomain(anchor.attr("href")) setUrlWithoutDomain(anchor.attr("href"))
title = anchor.text() title = anchor.text()
thumbnail_url = element.select(".book_avatar img").attr("abs:src") thumbnail_url = element.selectFirst(".book_avatar img")?.attr("abs:src")
} }
// Selector của nút trang kế tiếp // Selector của nút trang kế tiếp
@ -101,7 +99,7 @@ class TruyenQQ : ParsedHttpSource() {
author = info.select(".org").joinToString { it.text() } author = info.select(".org").joinToString { it.text() }
genre = document.select(".list01 li").joinToString { it.text() } genre = document.select(".list01 li").joinToString { it.text() }
description = document.select(".story-detail-info").textWithLinebreaks() description = document.select(".story-detail-info").textWithLinebreaks()
thumbnail_url = document.select("img[itemprop=image]").attr("abs:src") thumbnail_url = document.selectFirst("img[itemprop=image]")?.attr("abs:src")
status = when (info.select(".status > p:last-child").text()) { status = when (info.select(".status > p:last-child").text()) {
"Đang Cập Nhật" -> SManga.ONGOING "Đang Cập Nhật" -> SManga.ONGOING
"Hoàn Thành" -> SManga.COMPLETED "Hoàn Thành" -> SManga.COMPLETED
@ -119,7 +117,7 @@ class TruyenQQ : ParsedHttpSource() {
override fun chapterListSelector(): String = "div.works-chapter-list div.works-chapter-item" override fun chapterListSelector(): String = "div.works-chapter-list div.works-chapter-item"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
setUrlWithoutDomain(element.select("a").attr("href")) setUrlWithoutDomain(element.selectFirst("a")!!.attr("href"))
name = element.select("a").text().trim() name = element.select("a").text().trim()
date_upload = parseDate(element.select(".time-chap").text()) date_upload = parseDate(element.select(".time-chap").text())
} }