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> { 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 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 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) val payload = mapOf("code" to id, "csrv_token" to csrv_token, "pass" to captchaPass)
@ -25,11 +40,11 @@ open class Evoload : ExtractorApi() {
return listOf( return listOf(
ExtractorLink( ExtractorLink(
name, name,
name, name + flag,
link, link,
url, cleaned_url,
Qualities.Unknown.value, 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 private val srcRegex = Regex("""sources:.\[(.*?)\]""") // would be possible to use the parse and find src attribute
override val requiresReferer = true override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? { 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 -> srcRegex.find(this.text)?.groupValues?.get(1)?.replace("\"", "")?.let { link ->
return listOf( return listOf(
ExtractorLink( ExtractorLink(
name, name,
name, name + flag,
link, link,
url, cleaned_url,
Qualities.Unknown.value, Qualities.Unknown.value,
) )
) )

View file

@ -58,7 +58,7 @@ class FrenchStreamProvider : MainAPI() {
soup.selectFirst("div.fdesc").text().toString() soup.selectFirst("div.fdesc").text().toString()
.split("streaming", ignoreCase = true)[1].replace(" : ", "") .split("streaming", ignoreCase = true)[1].replace(" : ", "")
var poster = fixUrlNull(soup.selectFirst("div.fposter > img")?.attr("src")) var poster = fixUrlNull(soup.selectFirst("div.fposter > img")?.attr("src"))
val listEpisode = soup.selectFirst("div.elink") val listEpisode = soup.select("div.elink")
if (isMovie) { if (isMovie) {
val trailer = soup.selectFirst("div.fleft > span > a")?.attr("href") val trailer = soup.selectFirst("div.fleft > span > a")?.attr("href")
@ -86,20 +86,33 @@ class FrenchStreamProvider : MainAPI() {
) )
} else // a tv serie } 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) val epTitle = if (a.text()?.toString() != null)
if (a.text().contains("Episode")) { 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 { } else {
a.text() a.text()
} } else ""
else ""
if (poster == null) { if (poster == null) {
poster = a.selectFirst("div.fposter > img")?.attr("src") poster = a.selectFirst("div.fposter > img")?.attr("src")
} }
val epNum = Regex("""Episode (\d+)""").find(epTitle)?.destructured?.component1()
?.toIntOrNull()
TvSeriesEpisode( TvSeriesEpisode(
epTitle, epTitle,
null, null,
@ -128,11 +141,15 @@ class FrenchStreamProvider : MainAPI() {
fun translate( fun translate(
// the website has weird naming of series for episode 2 and 1 and original version content // the website has weird naming of series for episode 2 and 1 and original version content
episodeNumber: String, episodeNumber: String,
is_vf_available: Boolean,
): String { ): String {
return when (episodeNumber) { if (episodeNumber == "1") {
"ABCDE" -> "34" // ABCDE is episode 2 if (is_vf_available) { // 1 translate differently if vf is available or not
"1" -> "FGHIJK" return "FGHIJK"
else -> (episodeNumber.toInt() + 32).toString() } 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) 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 url = split[0]
val wantedEpisode = 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" "ABCDE"
} else { } else {
split[1] "episode" + split[1]
} }
val translated = translate(wantedEpisode)
val soup = app.get(fixUrl(url)).document val soup = app.get(fixUrl(url)).document
val div = val div =
if (wantedEpisode == "ABCDE") { // Causes issues trying to convert to int with ABCDE abviously if (wantedEpisode == "episode1") {
""
} else if (wantedEpisode.toInt() == 1) {
"> div.tabs-sel " // this element is added when the wanted episode is one (the place changes in the document) "> div.tabs-sel " // this element is added when the wanted episode is one (the place changes in the document)
} else { } else {
"" ""
} }
val serversvf =// French version servers 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 .mapNotNull { li -> // list of all french version servers
val serverUrl = fixUrl(li.selectFirst("a").attr("href")) val serverUrl = fixUrl(li.selectFirst("a").attr("href"))
// val litext = li.text() // val litext = li.text()
if (serverUrl != "") { if (serverUrl.isNotBlank()) {
if (li.text().replace("&nbsp;", "").replace(" ", "") != "") { if (li.text().replace("&nbsp;", "").replace(" ", "").isNotBlank()) {
Pair(li.text().replace(" ", ""), fixUrl(serverUrl)) Pair(li.text().replace(" ", ""), "vf" + fixUrl(serverUrl))
} else { } else {
null null
} }
@ -182,13 +196,14 @@ class FrenchStreamProvider : MainAPI() {
} }
} }
val translated = translate(split[1], serversvf.isNotEmpty())
val serversvo = // Original version servers 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 -> .mapNotNull { li ->
val serverUrl = fixUrlNull(li.selectFirst("a")?.attr("href")) val serverUrl = fixUrlNull(li.selectFirst("a")?.attr("href"))
if (!serverUrl.isNullOrEmpty()) { if (!serverUrl.isNullOrEmpty()) {
if (li.text().replace("&nbsp;", "").replace(" ", "") != "") { if (li.text().replace("&nbsp;", "").isNotBlank()) {
Pair(li.text().replace(" ", ""), fixUrl(serverUrl)) Pair(li.text().replace(" ", ""), "vo" + fixUrl(serverUrl))
} else { } else {
null null
} }
@ -204,7 +219,7 @@ class FrenchStreamProvider : MainAPI() {
val serverurl = fixUrlNull(a.attr("href")) ?: return@mapNotNull null val serverurl = fixUrlNull(a.attr("href")) ?: return@mapNotNull null
val parent = a.parents()[2] val parent = a.parents()[2]
val element = parent.selectFirst("a").text().plus(" ") 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)) Pair(element.plus(a.text()), fixUrl(serverurl))
} else { } else {
null null
@ -216,8 +231,8 @@ class FrenchStreamProvider : MainAPI() {
servers.apmap { servers.apmap {
for (extractor in extractorApis) { for (extractor in extractorApis) {
if (it.first.contains(extractor.name, ignoreCase = true)) { if (it.first.contains(extractor.name, ignoreCase = true)) {
// val name = it.first // val name = it.first
// print("true for $name") // print("true for $name")
extractor.getSafeUrl(it.second, it.second)?.forEach(callback) extractor.getSafeUrl(it.second, it.second)?.forEach(callback)
break break
} }