diff --git a/src/vi/truyengg/build.gradle b/src/vi/truyengg/build.gradle index 6dc5c9e19..356e90eda 100644 --- a/src/vi/truyengg/build.gradle +++ b/src/vi/truyengg/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'TruyenGG' extClass = '.TruyenGG' - extVersionCode = 2 + extVersionCode = 3 } apply from: "$rootDir/common.gradle" diff --git a/src/vi/truyengg/src/eu/kanade/tachiyomi/extension/vi/truyengg/TruyenGG.kt b/src/vi/truyengg/src/eu/kanade/tachiyomi/extension/vi/truyengg/TruyenGG.kt index ed4e82645..9c49ca19f 100644 --- a/src/vi/truyengg/src/eu/kanade/tachiyomi/extension/vi/truyengg/TruyenGG.kt +++ b/src/vi/truyengg/src/eu/kanade/tachiyomi/extension/vi/truyengg/TruyenGG.kt @@ -25,6 +25,7 @@ import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.text.SimpleDateFormat import java.util.Locale +import java.util.concurrent.TimeUnit class TruyenGG : ParsedHttpSource(), ConfigurableSource { @@ -39,7 +40,7 @@ class TruyenGG : ParsedHttpSource(), ConfigurableSource { override val baseUrl by lazy { getPrefBaseUrl() } override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimit(1) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = diff --git a/src/vi/truyenqq/build.gradle b/src/vi/truyenqq/build.gradle index 9e903d673..9e168b66e 100644 --- a/src/vi/truyenqq/build.gradle +++ b/src/vi/truyenqq/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'TruyenQQ' extClass = '.TruyenQQ' - extVersionCode = 15 + extVersionCode = 16 } apply from: "$rootDir/common.gradle" diff --git a/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt b/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt index df12be686..dbc8f9827 100644 --- a/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt +++ b/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.extension.vi.truyenqq 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.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -31,10 +32,7 @@ class TruyenQQ : ParsedHttpSource() { override val supportsLatest: Boolean = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .connectTimeout(30, TimeUnit.SECONDS) - .readTimeout(30, TimeUnit.SECONDS) - .retryOnConnectionFailure(true) - .followRedirects(true) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = @@ -53,7 +51,7 @@ class TruyenQQ : ParsedHttpSource() { val anchor = element.selectFirst(".book_info .qtip a")!! setUrlWithoutDomain(anchor.attr("href")) 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 @@ -101,7 +99,7 @@ class TruyenQQ : ParsedHttpSource() { author = info.select(".org").joinToString { it.text() } genre = document.select(".list01 li").joinToString { it.text() } 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()) { "Đang Cập Nhật" -> SManga.ONGOING "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 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() date_upload = parseDate(element.select(".time-chap").text()) }