From 85dd5326e73c8d0019b4c09c3a98acadf314dd78 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Tue, 18 Oct 2022 08:43:15 +0800 Subject: [PATCH] NewToki: fix domain number logic and update data (#13893) --- src/ko/newtoki/build.gradle | 2 +- src/ko/newtoki/domain_log.md | 102 ++++++++---------- .../extension/ko/newtoki/DomainNumber.kt | 15 +-- 3 files changed, 57 insertions(+), 62 deletions(-) diff --git a/src/ko/newtoki/build.gradle b/src/ko/newtoki/build.gradle index 89bf91f72..8ba73238e 100644 --- a/src/ko/newtoki/build.gradle +++ b/src/ko/newtoki/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'NewToki / ManaToki' pkgNameSuffix = 'ko.newtoki' extClass = '.TokiFactory' - extVersionCode = 25 + extVersionCode = 26 isNsfw = true } diff --git a/src/ko/newtoki/domain_log.md b/src/ko/newtoki/domain_log.md index 4214bc5ea..a6a2d8232 100644 --- a/src/ko/newtoki/domain_log.md +++ b/src/ko/newtoki/domain_log.md @@ -1,56 +1,48 @@ -1. Visit https://t.me/s/newtoki3 and load all messages. +Data from either https://t.me/s/newtoki5 or https://web.archive.org. -2. Run - ```js - $$(".tgme_widget_message_service_date").map(e => e.innerText) - ``` - -3. Paste the dates into a spreadsheet. - -4. Remove duplicates. - -The number is changed to 154 on 2022-09-21. - -| Date | Days | Average | -| ---------: | ---: | ------: | -| 2022-09-21 | 12 | 12.0 | -| 2022-09-09 | 7 | 9.5 | -| 2022-09-02 | 8 | 9.0 | -| 2022-08-25 | 6 | 8.3 | -| 2022-08-19 | 11 | 8.8 | -| 2022-08-08 | 10 | 9.0 | -| 2022-07-29 | 8 | 8.9 | -| 2022-07-21 | 9 | 8.9 | -| 2022-07-12 | 7 | 8.7 | -| 2022-07-05 | 11 | 8.9 | -| 2022-06-24 | 6 | 8.6 | -| 2022-06-18 | 8 | 8.6 | -| 2022-06-10 | 3 | 8.2 | -| 2022-06-07 | 11 | 8.4 | -| 2022-05-27 | 6 | 8.2 | -| 2022-05-21 | 11 | 8.4 | -| 2022-05-10 | 11 | 8.5 | -| 2022-04-29 | 6 | 8.4 | -| 2022-04-23 | 8 | 8.4 | -| 2022-04-15 | 6 | 8.3 | -| 2022-04-09 | 10 | 8.3 | -| 2022-03-30 | 11 | 8.5 | -| 2022-03-19 | 9 | 8.5 | -| 2022-03-10 | 14 | 8.7 | -| 2022-02-24 | 12 | 8.8 | -| 2022-02-12 | 15 | 9.1 | -| 2022-01-28 | 9 | 9.1 | -| 2022-01-19 | 9 | 9.1 | -| 2022-01-10 | 17 | 9.3 | -| 2021-12-24 | 7 | 9.3 | -| 2021-12-17 | 6 | 9.2 | -| 2021-12-11 | 8 | 9.1 | -| 2021-12-03 | 9 | 9.1 | -| 2021-11-24 | 8 | 9.1 | -| 2021-11-16 | 11 | 9.1 | -| 2021-11-05 | 7 | 9.1 | -| 2021-10-29 | 9 | 9.1 | -| 2021-10-20 | 12 | 9.2 | -| 2021-10-08 | 8 | 9.1 | -| 2021-09-30 | 15 | 9.3 | -| 2021-09-15 | | | \ No newline at end of file +| Date | Days | Average | Number | +| ---------: | ---: | ------: | -----: | +| 2022-10-16 | 8 | 8.0 | 158 | +| 2022-10-08 | 11 | 9.5 | 157 | +| 2022-09-27 | 6 | 8.3 | 156 | +| 2022-09-21 | 12 | 9.3 | 154 | +| 2022-09-09 | 7 | 8.8 | | +| 2022-09-02 | 8 | 8.7 | | +| 2022-08-25 | 6 | 8.3 | | +| 2022-08-19 | 11 | 8.6 | | +| 2022-08-08 | 10 | 8.8 | | +| 2022-07-29 | 8 | 8.7 | | +| 2022-07-21 | 9 | 8.7 | | +| 2022-07-12 | 7 | 8.6 | | +| 2022-07-05 | 11 | 8.8 | | +| 2022-06-24 | 6 | 8.6 | | +| 2022-06-18 | 8 | 8.5 | | +| 2022-06-10 | 3 | 8.2 | | +| 2022-06-07 | 11 | 8.4 | | +| 2022-05-27 | 6 | 8.2 | | +| 2022-05-21 | 11 | 8.4 | | +| 2022-05-10 | 11 | 8.5 | | +| 2022-04-29 | 6 | 8.4 | | +| 2022-04-23 | 8 | 8.4 | | +| 2022-04-15 | 6 | 8.3 | | +| 2022-04-09 | 10 | 8.3 | | +| 2022-03-30 | 11 | 8.4 | | +| 2022-03-19 | 9 | 8.5 | | +| 2022-03-10 | 14 | 8.7 | | +| 2022-02-24 | 12 | 8.8 | | +| 2022-02-12 | 15 | 9.0 | | +| 2022-01-28 | 9 | 9.0 | | +| 2022-01-19 | 9 | 9.0 | | +| 2022-01-10 | 17 | 9.3 | | +| 2021-12-24 | 7 | 9.2 | | +| 2021-12-17 | 6 | 9.1 | | +| 2021-12-11 | 8 | 9.1 | | +| 2021-12-03 | 9 | 9.1 | | +| 2021-11-24 | 8 | 9.0 | | +| 2021-11-16 | 11 | 9.1 | | +| 2021-11-05 | 7 | 9.0 | | +| 2021-10-29 | 9 | 9.0 | | +| 2021-10-20 | 12 | 9.1 | | +| 2021-10-08 | 8 | 9.1 | | +| 2021-09-30 | 15 | 9.2 | | +| 2021-09-15 | | | | \ No newline at end of file diff --git a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/DomainNumber.kt b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/DomainNumber.kt index 4817a3bb3..2b327c333 100644 --- a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/DomainNumber.kt +++ b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/DomainNumber.kt @@ -15,12 +15,12 @@ import java.io.IOException * It was merged after shutdown of ManaMoa. * This is by the head of Manamoa, as they decided to move to Newtoki. * - * Updated on 2022-09-21, see `domain_log.md`. + * Updated on 2022-10-16, see `domain_log.md`. * To avoid going too fast and to utilize redirections, * the number is decremented by 1 initially, - * and increments every 9.2 days which is a bit slower than the average. + * and increments every 9 days which is a bit slower than the average. */ -val fallbackDomainNumber get() = (154 - 1) + ((System.currentTimeMillis() - 1663723150_000) / 794880_000).toInt() +val fallbackDomainNumber get() = (158 - 1) + ((System.currentTimeMillis() - 1665882000_000) / 777600_000).toInt() var domainNumber = "" get() { @@ -52,13 +52,16 @@ object DomainInterceptor : Interceptor { chain.proceed(request) } catch (e: IOException) { if (chain.call().isCanceled()) throw e + Log.e("NewToki", "failed to fetch ${request.url}", e) val newDomainNumber = try { - val document = chain.proceed(GET("https://t.me/s/newtoki3")).asJsoup() - val description = document.selectFirst("meta[property=og:description]").attr("content") + val document = chain.proceed(GET("https://t.me/s/newtoki5")).asJsoup() + val description = document.select("a[href^=https://newtoki]").last()!!.attr("href") numberRegex.find(description)!!.value } catch (_: Throwable) { - fallbackDomainNumber.toString() + fallbackDomainNumber + .also { if (it <= domainNumber.toInt()) throw e } + .toString() } domainNumber = newDomainNumber