parent
685ac1ff01
commit
ff98102d69
|
@ -5,7 +5,7 @@ ext {
|
|||
appName = 'Tachiyomi: NewToki'
|
||||
pkgNameSuffix = 'ko.newtoki'
|
||||
extClass = '.NewTokiFactory'
|
||||
extVersionCode = 9
|
||||
extVersionCode = 10
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,16 @@ import eu.kanade.tachiyomi.source.model.Filter
|
|||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.Request
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.Date
|
||||
|
||||
private const val baseDomain = "newtoki26"
|
||||
/**
|
||||
* Source changes domain names approximately once every 10 days (e.g. newtoki31.net to newtoki32.net)
|
||||
* The domain name was newtoki32 on 2019-11-14, this should increment that by 1 for every 10 days that pass
|
||||
* If that rate holds and the code is correct, this should be accurate for a good while
|
||||
*/
|
||||
private val domainNumber = 32 + ((Date().time - SimpleDateFormat("yyyy-MM-dd", Locale.US).parse("2019-11-14").time) / 864000000)
|
||||
|
||||
class NewTokiFactory : SourceFactory {
|
||||
override fun createSources(): List<Source> = listOf(
|
||||
|
@ -17,9 +25,9 @@ class NewTokiFactory : SourceFactory {
|
|||
)
|
||||
}
|
||||
|
||||
class NewTokiManga : NewToki("NewToki", "https://$baseDomain.net", "comic")
|
||||
class NewTokiManga : NewToki("NewToki", "https://newtoki$domainNumber.net", "comic")
|
||||
|
||||
class NewTokiWebtoon : NewToki("NewToki (Webtoon)", "https://$baseDomain.com", "webtoon") {
|
||||
class NewTokiWebtoon : NewToki("NewToki (Webtoon)", "https://newtoki$domainNumber.com", "webtoon") {
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
val url = HttpUrl.parse("$baseUrl/webtoon" + (if (page > 1) "/p$page" else ""))!!.newBuilder()
|
||||
filters.forEach { filter ->
|
||||
|
|
Loading…
Reference in New Issue