fixed the qualities scraping in tenshi.moe

This commit is contained in:
Arjix 2021-07-22 20:27:43 +03:00 committed by GitHub
parent bb2928fa7b
commit 2ac8d45237
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -248,25 +248,20 @@ class TenshiProvider : MainAPI() {
): 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 src = Jsoup.parse(response.text).selectFirst(".embed-responsive > iframe").attr("src")
val mp4moe = Jsoup.parse(khttp.get(src).text).selectFirst("video#player") val mp4moe = Jsoup.parse(khttp.get(src, headers=mapOf("Referer" to data)).text).selectFirst("video#player")
for (source in mp4moe.select("source")) { val sources = mp4moe.select("source").map {
try {
val quality = source.attr("title")
val link = source.attr("src")
callback.invoke(
ExtractorLink( ExtractorLink(
this.name, this.name,
"${this.name} $quality" + if (quality.endsWith('p')) "" else 'p', "${this.name} ${it.attr("title")}" + if (it.attr("title").endsWith('p')) "" else 'p',
fixUrl(link), fixUrl(it.attr("src")),
this.mainUrl, this.mainUrl,
getQualityFromName(quality) getQualityFromName(it.attr("title"))
) )
)
} catch (e: Exception) {
//IDK
} }
for (source in sources) {
callback.invoke(source)
} }
return true return true
} }