fixed french-stream.kt and fixed merge conflict (#632)

* added French-stream.re

* changed something ?

* Delete runConfigurations.xml

* Update Uqload.kt

* Update french-stream.kt

* renamed _ variable

switched from "idk" to "_ "variable name

* code cleanup at request of @LagradOst

* Update french-stream.kt

* Update Uqload.kt

* Update Evolaod.kt

* Create pull_branch_build.yml

* Delete pull_branch_build.yml

* Update french-stream.kt

* removed the println I forgot

Co-authored-by: Arjix <53124886+ArjixWasTaken@users.noreply.github.com>
Co-authored-by: LagradOst <46196380+Blatzar@users.noreply.github.com>
This commit is contained in:
Sarlay 2022-02-11 17:59:24 +00:00 committed by GitHub
parent b122c19a48
commit d1278f97e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 36 deletions

View File

@ -16,7 +16,22 @@ open class Evoload : ExtractorApi() {
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val id = url.replace("https://evoload.io/e/", "") // wanted media id
val lang = url.substring(0, 2)
val flag =
if (lang == "vo") {
" \uD83C\uDDEC\uD83C\uDDE7"
}
else if (lang == "vf"){
" \uD83C\uDDE8\uD83C\uDDF5"
} else {
""
}
val cleaned_url = url.substring(2, url.length)
//println(lang)
//println(cleaned_url)
val id = cleaned_url.replace("https://evoload.io/e/", "") // wanted media id
val csrv_token = app.get("https://csrv.evosrv.com/captcha?m412548=").text // whatever that is
val captchaPass = app.get("https://cd2.evosrv.com/html/jsx/e.jsx").text.take(300).split("captcha_pass = '")[1].split("\'")[0] //extract the captcha pass from the js response (located in the 300 first chars)
val payload = mapOf("code" to id, "csrv_token" to csrv_token, "pass" to captchaPass)
@ -25,11 +40,11 @@ open class Evoload : ExtractorApi() {
return listOf(
ExtractorLink(
name,
name,
name + flag,
link,
url,
cleaned_url,
Qualities.Unknown.value,
)
)
}
}
}

View File

@ -13,15 +13,27 @@ open class Uqload : ExtractorApi() {
private val srcRegex = Regex("""sources:.\[(.*?)\]""") // would be possible to use the parse and find src attribute
override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
with(app.get(url)) { // raised error ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED (3003) is due to the response: "error_nofile"
val lang = url.substring(0, 2)
val flag =
if (lang == "vo") {
" \uD83C\uDDEC\uD83C\uDDE7"
}
else if (lang == "vf"){
" \uD83C\uDDE8\uD83C\uDDF5"
} else {
""
}
val cleaned_url = url.substring(2, url.length)
with(app.get(cleaned_url)) { // raised error ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED (3003) is due to the response: "error_nofile"
srcRegex.find(this.text)?.groupValues?.get(1)?.replace("\"", "")?.let { link ->
return listOf(
ExtractorLink(
name,
name,
name + flag,
link,
url,
cleaned_url,
Qualities.Unknown.value,
)
)

View File

@ -58,7 +58,7 @@ class FrenchStreamProvider : MainAPI() {
soup.selectFirst("div.fdesc").text().toString()
.split("streaming", ignoreCase = true)[1].replace(" : ", "")
var poster = fixUrlNull(soup.selectFirst("div.fposter > img")?.attr("src"))
val listEpisode = soup.selectFirst("div.elink")
val listEpisode = soup.select("div.elink")
if (isMovie) {
val trailer = soup.selectFirst("div.fleft > span > a")?.attr("href")
@ -86,20 +86,33 @@ class FrenchStreamProvider : MainAPI() {
)
} else // a tv serie
{
val episodes = listEpisode.select("a").map { a ->
//println(listEpisode)
//println("listeEpisode:")
val episode_list = if ("<a" !in (listEpisode[0]).toString()) { // check if VF is empty
listEpisode[1] // no vf, return vostfr
}
else {
listEpisode[0] // no vostfr, return vf
}
//println(url)
val episodes = episode_list.select("a").map { a ->
val epNum = a.text().split("Episode")[1].trim().toIntOrNull()
val epTitle = if (a.text()?.toString() != null)
if (a.text().contains("Episode")) {
"Episode " + a.text().split("Episode")[1].trim()
val type = if ("honey" in a.attr("id")) {
"VF"
} else {
"VOSTFR"
}
"Episode " + epNum?.toString() + " en " + type
} else {
a.text()
}
else ""
} else ""
if (poster == null) {
poster = a.selectFirst("div.fposter > img")?.attr("src")
}
val epNum = Regex("""Episode (\d+)""").find(epTitle)?.destructured?.component1()
?.toIntOrNull()
TvSeriesEpisode(
epTitle,
null,
@ -128,11 +141,15 @@ class FrenchStreamProvider : MainAPI() {
fun translate(
// the website has weird naming of series for episode 2 and 1 and original version content
episodeNumber: String,
is_vf_available: Boolean,
): String {
return when (episodeNumber) {
"ABCDE" -> "34" // ABCDE is episode 2
"1" -> "FGHIJK"
else -> (episodeNumber.toInt() + 32).toString()
if (episodeNumber == "1") {
if (is_vf_available) { // 1 translate differently if vf is available or not
return "FGHIJK"
} else { return "episode033" }
}
else {
return "episode" + (episodeNumber.toInt() + 32).toString()
}
}
@ -149,31 +166,28 @@ class FrenchStreamProvider : MainAPI() {
data.split("-episodenumber:") // the data contains the url and the wanted episode number (a temporary dirty fix that will last forever)
val url = split[0]
val wantedEpisode =
if (split[1] == "2") { // the episode number 2 has id of ABCDE, no questions asked
if (split[1] == "2") { // the episode number 2 has id of ABCDE, don't ask any question
"ABCDE"
} else {
split[1]
"episode" + split[1]
}
val translated = translate(wantedEpisode)
val soup = app.get(fixUrl(url)).document
val div =
if (wantedEpisode == "ABCDE") { // Causes issues trying to convert to int with ABCDE abviously
""
} else if (wantedEpisode.toInt() == 1) {
if (wantedEpisode == "episode1") {
"> div.tabs-sel " // this element is added when the wanted episode is one (the place changes in the document)
} else {
""
}
val serversvf =// French version servers
soup.select("div#episode$wantedEpisode > div.selink > ul.btnss $div> li")
soup.select("div#$wantedEpisode > div.selink > ul.btnss $div> li")
.mapNotNull { li -> // list of all french version servers
val serverUrl = fixUrl(li.selectFirst("a").attr("href"))
// val litext = li.text()
if (serverUrl != "") {
if (li.text().replace("&nbsp;", "").replace(" ", "") != "") {
Pair(li.text().replace(" ", ""), fixUrl(serverUrl))
if (serverUrl.isNotBlank()) {
if (li.text().replace("&nbsp;", "").replace(" ", "").isNotBlank()) {
Pair(li.text().replace(" ", ""), "vf" + fixUrl(serverUrl))
} else {
null
}
@ -182,13 +196,14 @@ class FrenchStreamProvider : MainAPI() {
}
}
val translated = translate(split[1], serversvf.isNotEmpty())
val serversvo = // Original version servers
soup.select("div#episode$translated > div.selink > ul.btnss $div> li")
soup.select("div#$translated > div.selink > ul.btnss $div> li")
.mapNotNull { li ->
val serverUrl = fixUrlNull(li.selectFirst("a")?.attr("href"))
if (!serverUrl.isNullOrEmpty()) {
if (li.text().replace("&nbsp;", "").replace(" ", "") != "") {
Pair(li.text().replace(" ", ""), fixUrl(serverUrl))
if (li.text().replace("&nbsp;", "").isNotBlank()) {
Pair(li.text().replace(" ", ""), "vo" + fixUrl(serverUrl))
} else {
null
}
@ -204,7 +219,7 @@ class FrenchStreamProvider : MainAPI() {
val serverurl = fixUrlNull(a.attr("href")) ?: return@mapNotNull null
val parent = a.parents()[2]
val element = parent.selectFirst("a").text().plus(" ")
if (a.text().replace("&nbsp;", "").trim() != "") {
if (a.text().replace("&nbsp;", "").isNotBlank()) {
Pair(element.plus(a.text()), fixUrl(serverurl))
} else {
null
@ -216,8 +231,8 @@ class FrenchStreamProvider : MainAPI() {
servers.apmap {
for (extractor in extractorApis) {
if (it.first.contains(extractor.name, ignoreCase = true)) {
// val name = it.first
// print("true for $name")
// val name = it.first
// print("true for $name")
extractor.getSafeUrl(it.second, it.second)?.forEach(callback)
break
}