forked from AlmightyHak/extensions-source
parent
c8733e6195
commit
ee23fc1e19
2 changed files with 12 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Anitube'
|
extName = 'Anitube'
|
||||||
extClass = '.Anitube'
|
extClass = '.Anitube'
|
||||||
extVersionCode = 22
|
extVersionCode = 23
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -30,10 +30,14 @@ class AnitubeExtractor(
|
||||||
|
|
||||||
private fun checkVideoExists(url: String): VideoExists {
|
private fun checkVideoExists(url: String): VideoExists {
|
||||||
try {
|
try {
|
||||||
|
val newHeaders = headers.newBuilder()
|
||||||
|
.set("Connection", "close")
|
||||||
|
.build()
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.head()
|
.head()
|
||||||
.url(url)
|
.url(url)
|
||||||
.headers(headers)
|
.headers(newHeaders)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
|
@ -44,6 +48,8 @@ class AnitubeExtractor(
|
||||||
if (e.message?.contains("Unexpected status line") == true) {
|
if (e.message?.contains("Unexpected status line") == true) {
|
||||||
return VideoExists(true, 200)
|
return VideoExists(true, 200)
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.d(tag, "Failed to check video, error: ${e.message}")
|
||||||
}
|
}
|
||||||
|
|
||||||
return VideoExists(false, 404)
|
return VideoExists(false, 404)
|
||||||
|
@ -108,7 +114,7 @@ class AnitubeExtractor(
|
||||||
.body.string()
|
.body.string()
|
||||||
|
|
||||||
val adsUrl = body.let {
|
val adsUrl = body.let {
|
||||||
Regex("""urlToFetch\s*=\s*['"]([^'"]+)['"]""")
|
Regex("""(?:urlToFetch|ADS_URL)\s*=\s*['"]([^'"]+)['"]""")
|
||||||
.find(it)?.groups?.get(1)?.value
|
.find(it)?.groups?.get(1)?.value
|
||||||
?: ""
|
?: ""
|
||||||
}
|
}
|
||||||
|
@ -123,7 +129,7 @@ class AnitubeExtractor(
|
||||||
|
|
||||||
// Try default url
|
// Try default url
|
||||||
Log.e(tag, "Failed to get the ADS URL, trying the default")
|
Log.e(tag, "Failed to get the ADS URL, trying the default")
|
||||||
return "https://s4.cdnpc.net/vite-bundle/main.css?version=v93"
|
return "https://widgets.outbrain.com/outbrain.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAuthCode(serverUrl: String, thumbUrl: String, link: String): String {
|
private fun getAuthCode(serverUrl: String, thumbUrl: String, link: String): String {
|
||||||
|
@ -212,6 +218,7 @@ class AnitubeExtractor(
|
||||||
val serverUrl = doc.selectFirst("meta[itemprop=contentURL]")!!
|
val serverUrl = doc.selectFirst("meta[itemprop=contentURL]")!!
|
||||||
.attr("content")
|
.attr("content")
|
||||||
.replace("cdn1", "cdn3")
|
.replace("cdn1", "cdn3")
|
||||||
|
.replace("cdn80", "cdn8")
|
||||||
val thumbUrl = doc.selectFirst("meta[itemprop=thumbnailUrl]")!!
|
val thumbUrl = doc.selectFirst("meta[itemprop=thumbnailUrl]")!!
|
||||||
.attr("content")
|
.attr("content")
|
||||||
val type = serverUrl.split("/").get(3)
|
val type = serverUrl.split("/").get(3)
|
||||||
|
@ -249,7 +256,7 @@ class AnitubeExtractor(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val PREF_AUTHCODE_KEY = "authcode"
|
private const val PREF_AUTHCODE_KEY = "authcode"
|
||||||
private const val ADS_URL = "https://ads.anitube.vip/adblock.php"
|
private const val ADS_URL = "https://ads.anitube.vip/adblockturbo.php"
|
||||||
private const val SITE_URL = "https://www.anitube.vip/playerricas.php"
|
private const val SITE_URL = "https://www.anitube.vip/playerricas.php"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue