[Sora] fixed FDMovies

This commit is contained in:
hexated 2023-01-03 00:15:40 +07:00
parent b205d0d2e4
commit 9efe1fa482
2 changed files with 35 additions and 20 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 67 version = 68
cloudstream { cloudstream {

View file

@ -262,32 +262,47 @@ fun getDirectGdrive(url: String): String {
} }
} }
suspend fun bypassFdAds(url: String): String? { suspend fun bypassFdAds(url: String?): String? {
val res = app.get(url).document val freeRedirect = app.get(url ?: return null, verify = false).document.selectFirst("a#link")?.attr("href")
val freeRedirect = res.selectFirst("a#link")?.attr("href") val res = app.get(freeRedirect ?: return null,verify = false).document
val res2 = app.get(freeRedirect ?: return null, verify = false).document val formLink = res.select("form#landing").attr("action")
val formLink = res2.select("form#landing").attr("action") val value = res.select("form#landing input").attr("value")
val value = res2.select("form#landing input").attr("value")
val res3 = app.post(formLink, data = mapOf("go" to value), verify = false).document val headers = mapOf(
val formLink2 = res3.select("form#landing").attr("action") "Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
val humanVer = res3.select("form#landing input[name=humanverification]").attr("value") "Content-Type" to "application/x-www-form-urlencoded"
val newwp = res3.select("form#landing input[name=newwpsafelink]").attr("value") )
val res4 = app.post(
val res2 = app.post(formLink, data = mapOf("go" to value), verify = false, headers = headers).document
val formLink2 = res2.select("form#landing").attr("action")
val humanVer = res2.select("form#landing input[name=humanverification]").attr("value")
val newwp = res2.select("form#landing input[name=newwpsafelink]").attr("value")
val res3 = app.post(
formLink2, formLink2,
data = mapOf("humanverification" to humanVer, "newwpsafelink" to newwp), requestBody = FormBody.Builder()
.add("humanverification", humanVer)
.add("newwpsafelink", newwp)
.build(),
headers = headers,
verify = false verify = false
).document ).document
val formLink3 = res4.select("form#wpsafelink-landing").attr("action")
val newwpsafelink = val formLink3 = res3.select("form#wpsafelink-landing").attr("action")
res4.select("form#wpsafelink-landing input[name=newwpsafelink]").attr("value") val newwpsafelink = res3.select("form#wpsafelink-landing input[name=newwpsafelink]").attr("value")
val res5 = app.post(
val res4 = app.post(
formLink3, formLink3,
data = mapOf("newwpsafelink" to newwpsafelink), requestBody = FormBody.Builder()
.add("newwpsafelink", newwpsafelink)
.build(),
headers = headers,
verify = false verify = false
).document ).document
val finalLink = res5.selectFirst("div#wpsafe-link a")?.attr("onclick")?.substringAfter("open('")
val finalLink = res4.selectFirst("div#wpsafe-link a")?.attr("onclick")?.substringAfter("open('")
?.substringBefore("',") ?.substringBefore("',")
return app.get(finalLink ?: return null, verify = false).url return app.get(finalLink ?: return null).url
} }
suspend fun bypassHrefli(url: String): String? { suspend fun bypassHrefli(url: String): String? {