mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fixed tenshi.moe
This commit is contained in:
parent
f394469787
commit
565f51aaff
1 changed files with 35 additions and 10 deletions
|
@ -290,17 +290,41 @@ class TenshiProvider : MainAPI() {
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val response = khttp.get(data)
|
val response = khttp.get(data)
|
||||||
val src = Jsoup.parse(response.text).selectFirst(".embed-responsive > iframe").attr("src")
|
val soup = Jsoup.parse(response.text)
|
||||||
val mp4moe = Jsoup.parse(khttp.get(src, headers = mapOf("Referer" to data)).text).selectFirst("video#player")
|
|
||||||
|
|
||||||
val sources = mp4moe.select("source").map {
|
data class Quality(
|
||||||
|
@JsonProperty("src") val src: String,
|
||||||
|
@JsonProperty("size") val size: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
val sources = ArrayList<ExtractorLink>()
|
||||||
|
for (source in soup.select("""[aria-labelledby="mirror-dropdown"] > li > a.dropdown-item""")) {
|
||||||
|
val release = source.text().replace("/", "").trim()
|
||||||
|
val sourceHTML = khttp.get(
|
||||||
|
"https://tenshi.moe/embed?v=${source.attr("href").split("v=")[1].split("&")[0]}",
|
||||||
|
headers=mapOf("Referer" to data)
|
||||||
|
).text
|
||||||
|
|
||||||
|
val match = Regex("""sources: (\[(?:.|\s)+?type: ['\"]video\/.*?['\"](?:.|\s)+?\])""").find(sourceHTML)
|
||||||
|
if (match != null) {
|
||||||
|
val qualities = mapper.readValue<List<Quality>>(
|
||||||
|
match.destructured.component1()
|
||||||
|
.replace("'", "\"")
|
||||||
|
.replace(Regex("""(\w+): """), "\"\$1\": ")
|
||||||
|
.replace(Regex("""\s+"""), "")
|
||||||
|
.replace(",}", "}")
|
||||||
|
.replace(",]", "]")
|
||||||
|
)
|
||||||
|
sources.addAll(qualities.map {
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
this.name,
|
this.name,
|
||||||
"${this.name} - ${it.attr("title")}" + if (it.attr("title").endsWith('p')) "" else 'p',
|
"${this.name} $release - " + it.size + "p",
|
||||||
fixUrl(it.attr("src")),
|
fixUrl(it.src),
|
||||||
this.mainUrl,
|
this.mainUrl,
|
||||||
getQualityFromName(it.attr("title"))
|
getQualityFromName("${it.size}")
|
||||||
)
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (source in sources) {
|
for (source in sources) {
|
||||||
|
@ -309,3 +333,4 @@ class TenshiProvider : MainAPI() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue