mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-22 10:22:47 +01:00
parent
97ce648e34
commit
360a00e325
@ -1,18 +1,13 @@
|
|||||||
package eu.kanade.tachiyomi.extension.pt.traducoesdolipe
|
package eu.kanade.tachiyomi.extension.pt.traducoesdolipe
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistManga
|
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistManga
|
||||||
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistMangaDto
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import okhttp3.Request
|
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
|
||||||
|
|
||||||
class TraducoesDoLipe : ZeistManga(
|
class TraducoesDoLipe : ZeistManga(
|
||||||
"Traduções do Lipe",
|
"Traduções do Lipe",
|
||||||
@ -42,32 +37,16 @@ class TraducoesDoLipe : ZeistManga(
|
|||||||
setUrlWithoutDomain(document.location())
|
setUrlWithoutDomain(document.location())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun chapterListRequest(manga: SManga): Request {
|
override fun getChapterFeedUrl(doc: Document): String {
|
||||||
val projectName = manga.url.substringAfterLast("#")
|
val feed = doc.select("script").map(Element::html)
|
||||||
val url = apiUrl(chapterCategory)
|
|
||||||
.addPathSegments(projectName)
|
|
||||||
.addQueryParameter("max-results", maxChapterResults.toString())
|
|
||||||
.build()
|
|
||||||
return GET(url, headers)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
|
||||||
val project = client.newCall(mangaDetailsRequest(manga)).execute().let {
|
|
||||||
it.asJsoup().select("script").map(Element::html)
|
|
||||||
.firstOrNull { script -> script.contains("catNameProject") }
|
.firstOrNull { script -> script.contains("catNameProject") }
|
||||||
?.let { script -> PROJECT_NAME_REGEX.find(script)?.groups?.get("project")?.value }
|
?.let { script -> PROJECT_NAME_REGEX.find(script)?.groups?.get("project")?.value }
|
||||||
}
|
?: throw Exception("Não foi possivel encontrar o nome do projeto")
|
||||||
|
|
||||||
return client.newCall(chapterListRequest(manga.apply { url = "$url#$project" }))
|
return apiUrl(chapterCategory)
|
||||||
.asObservableSuccess()
|
.addPathSegments(feed)
|
||||||
.map(::chapterListParse)
|
.addQueryParameter("max-results", maxChapterResults.toString())
|
||||||
}
|
.build().toString()
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
|
||||||
val result = json.decodeFromString<ZeistMangaDto>(response.body.string())
|
|
||||||
return result.feed?.entry?.filter { it.category.orEmpty().any { category -> category.term == chapterCategory } }
|
|
||||||
?.map { it.toSChapter(baseUrl) }
|
|
||||||
?: throw Exception("Failed to parse from chapter API")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
|
Loading…
Reference in New Issue
Block a user