parent
3ed674a201
commit
7e7aa7da3c
3 changed files with 43 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Anitube'
|
extName = 'Anitube'
|
||||||
extClass = '.Anitube'
|
extClass = '.Anitube'
|
||||||
extVersionCode = 14
|
extVersionCode = 15
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -176,7 +176,7 @@ class Anitube : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================ Video Links =============================
|
// ============================ Video Links =============================
|
||||||
override fun videoListParse(response: Response) = AnitubeExtractor.getVideoList(response, headers)
|
override fun videoListParse(response: Response) = AnitubeExtractor.getVideoList(response, headers, client)
|
||||||
override fun videoListSelector() = throw UnsupportedOperationException()
|
override fun videoListSelector() = throw UnsupportedOperationException()
|
||||||
override fun videoFromElement(element: Element) = throw UnsupportedOperationException()
|
override fun videoFromElement(element: Element) = throw UnsupportedOperationException()
|
||||||
override fun videoUrlParse(document: Document) = throw UnsupportedOperationException()
|
override fun videoUrlParse(document: Document) = throw UnsupportedOperationException()
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
package eu.kanade.tachiyomi.animeextension.pt.anitube.extractors
|
package eu.kanade.tachiyomi.animeextension.pt.anitube.extractors
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.animesource.model.Video
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import okhttp3.FormBody
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
|
||||||
object AnitubeExtractor {
|
object AnitubeExtractor {
|
||||||
fun getVideoList(response: Response, headers: Headers): List<Video> {
|
fun getVideoList(response: Response, headers: Headers, client: OkHttpClient): List<Video> {
|
||||||
val doc = response.asJsoup()
|
val doc = response.asJsoup()
|
||||||
val hasFHD = doc.selectFirst("div.abaItem:contains(FULLHD)") != null
|
val hasFHD = doc.selectFirst("div.abaItem:contains(FULLHD)") != null
|
||||||
val serverUrl = doc.selectFirst("meta[itemprop=contentURL]")!!
|
val serverUrl = doc.selectFirst("meta[itemprop=contentURL]")!!
|
||||||
.attr("content")
|
.attr("content")
|
||||||
.replace("cdn1", "cdn3")
|
.replace("cdn1", "cdn3")
|
||||||
|
val thumbUrl = doc.selectFirst("meta[itemprop=thumbnailUrl]")!!
|
||||||
|
.attr("content")
|
||||||
val type = serverUrl.split("/").get(3)
|
val type = serverUrl.split("/").get(3)
|
||||||
val qualities = listOfNotNull("SD", "HD", if (hasFHD) "FULLHD" else null)
|
val qualities = listOfNotNull("SD", "HD", if (hasFHD) "FULLHD" else null)
|
||||||
val paths = listOf("appsd", "apphd").let {
|
val paths = listOf("appsd", "apphd").let {
|
||||||
|
@ -21,9 +27,42 @@ object AnitubeExtractor {
|
||||||
it
|
it
|
||||||
}
|
}
|
||||||
} + listOf("appfullhd")
|
} + listOf("appfullhd")
|
||||||
|
|
||||||
|
val videoName = serverUrl.split('/').last()
|
||||||
|
|
||||||
|
val adsUrl =
|
||||||
|
client.newCall(GET("https://www.anitube.vip/playerricas.php?name=apphd/$videoName&img=$thumbUrl&url=$serverUrl"))
|
||||||
|
.execute()
|
||||||
|
.body.string()
|
||||||
|
.substringAfter("ADS_URL")
|
||||||
|
.substringAfter('"')
|
||||||
|
.substringBefore('"')
|
||||||
|
|
||||||
|
val adsContent = client.newCall(GET(adsUrl)).execute().body.string()
|
||||||
|
|
||||||
|
val body = FormBody.Builder()
|
||||||
|
.add("category", "client")
|
||||||
|
.add("type", "premium")
|
||||||
|
.add("ad", adsContent)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val publicidade = client.newCall(POST("https://ads.anitube.vip/", body = body))
|
||||||
|
.execute()
|
||||||
|
.body.string()
|
||||||
|
.substringAfter("\"publicidade\"")
|
||||||
|
.substringAfter('"')
|
||||||
|
.substringBefore('"')
|
||||||
|
|
||||||
|
val authCode = client.newCall(GET("https://ads.anitube.vip/?token=$publicidade"))
|
||||||
|
.execute()
|
||||||
|
.body.string()
|
||||||
|
.substringAfter("\"publicidade\"")
|
||||||
|
.substringAfter('"')
|
||||||
|
.substringBefore('"')
|
||||||
|
|
||||||
return qualities.mapIndexed { index, quality ->
|
return qualities.mapIndexed { index, quality ->
|
||||||
val path = paths[index]
|
val path = paths[index]
|
||||||
val url = serverUrl.replace(type, path)
|
val url = serverUrl.replace(type, path) + authCode
|
||||||
Video(url, quality, url, headers = headers)
|
Video(url, quality, url, headers = headers)
|
||||||
}.reversed()
|
}.reversed()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue