Update NewToki due to site update. (#821)

Update NewToki due to site update.
This commit is contained in:
DitFranXX 2019-02-15 18:23:09 +09:00 committed by Carlos
parent c1b987fa6e
commit b85ea810c1
2 changed files with 23 additions and 6 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: NewToki' appName = 'Tachiyomi: NewToki'
pkgNameSuffix = 'ko.newtoki' pkgNameSuffix = 'ko.newtoki'
extClass = '.NewToki' extClass = '.NewToki'
extVersionCode = 2 extVersionCode = 3
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -18,12 +18,29 @@ import java.util.*
**/ **/
class NewToki : ParsedHttpSource() { class NewToki : ParsedHttpSource() {
override val name = "NewToki" override val name = "NewToki"
override val baseUrl = "https://newtoki.net" override val baseUrl = "https://newtoki2.net"
override val lang: String = "ko" override val lang: String = "ko"
// Latest updates currently returns duplicate manga as it separates manga into chapters // Latest updates currently returns duplicate manga as it separates manga into chapters
override val supportsLatest = false override val supportsLatest = false
override val client: OkHttpClient = network.cloudflareClient override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.addInterceptor { chain ->
val req = chain.request()
var res: Response? = null
for (_i in 0..10) {
try {
res = chain.proceed(req)
} catch (e: javax.net.ssl.SSLHandshakeException) {
if (e.message!!.contains("Connection reset by peer")) continue
}
break
}
res ?: chain.proceed(req)
}
.build()!!
override fun popularMangaSelector() = "div#webtoon-list > ul > li" override fun popularMangaSelector() = "div#webtoon-list > ul > li"
@ -32,7 +49,7 @@ class NewToki : ParsedHttpSource() {
val manga = SManga.create() val manga = SManga.create()
manga.setUrlWithoutDomain(linkElement.attr("href")) manga.setUrlWithoutDomain(linkElement.attr("href"))
manga.title = element.attr("date-title") manga.title = element.select("span.title").first().ownText()
manga.thumbnail_url = linkElement.getElementsByTag("img").attr("src") manga.thumbnail_url = linkElement.getElementsByTag("img").attr("src")
return manga return manga
} }
@ -66,9 +83,9 @@ class NewToki : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val info = document.select("div.view-title").first() val info = document.select("div.view-title > .view-content").first()
val authorText = info.select("span.label.btn-info").text() val authorText = info.select("span.label.btn-info").text()
val title = info.select(".view-content > span > b").text() val title = info.select("div.view-content > span[style] > b").text()
val genres = mutableListOf<String>() val genres = mutableListOf<String>()
info.select("span.label.label-success").forEach { info.select("span.label.label-success").forEach {
genres.add(it.text()) genres.add(it.text())