[skip ci] refactor: Remove (most) unnecessary .use block usages (#2841)

Co-authored-by: jmir1 <jhmiramon@gmail.com>
This commit is contained in:
Claudemirovsky 2024-01-29 10:01:32 -03:00 committed by GitHub
parent ace0dbf5d2
commit d058cd77f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
175 changed files with 504 additions and 519 deletions

View File

@ -8,7 +8,7 @@ import okhttp3.OkHttpClient
class BloggerExtractor(private val client: OkHttpClient) { class BloggerExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, headers: Headers, suffix: String = ""): List<Video> { fun videosFromUrl(url: String, headers: Headers, suffix: String = ""): List<Video> {
return client.newCall(GET(url, headers)).execute() return client.newCall(GET(url, headers)).execute()
.use { it.body.string() } .body.string()
.takeIf { !it.contains("errorContainer") } .takeIf { !it.contains("errorContainer") }
.let { it ?: return emptyList() } .let { it ?: return emptyList() }
.substringAfter("\"streams\":[") .substringAfter("\"streams\":[")

View File

@ -18,7 +18,7 @@ class BurstCloudExtractor(private val client: OkHttpClient) {
val newHeaders = headers.newBuilder().set("referer", BURSTCLOUD_URL).build() val newHeaders = headers.newBuilder().set("referer", BURSTCLOUD_URL).build()
return runCatching { return runCatching {
val response = client.newCall(GET(url, newHeaders)).execute() val response = client.newCall(GET(url, newHeaders)).execute()
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val videoId = document.selectFirst("div#player")!!.attr("data-file-id") val videoId = document.selectFirst("div#player")!!.attr("data-file-id")
val formBody = FormBody.Builder() val formBody = FormBody.Builder()
@ -27,7 +27,7 @@ class BurstCloudExtractor(private val client: OkHttpClient) {
val jsonHeaders = headers.newBuilder().set("referer", document.location()).build() val jsonHeaders = headers.newBuilder().set("referer", document.location()).build()
val request = POST("$BURSTCLOUD_URL/file/play-request/", jsonHeaders, formBody) val request = POST("$BURSTCLOUD_URL/file/play-request/", jsonHeaders, formBody)
val jsonString = client.newCall(request).execute().use { it.body.string() } val jsonString = client.newCall(request).execute().body.string()
val jsonObj = json.decodeFromString<BurstCloudDto>(jsonString) val jsonObj = json.decodeFromString<BurstCloudDto>(jsonString)
val videoUrl = jsonObj.purchase.cdnUrl val videoUrl = jsonObj.purchase.cdnUrl

View File

@ -35,7 +35,7 @@ class ChillxExtractor(private val client: OkHttpClient, private val headers: Hea
.set("Accept-Language", "en-US,en;q=0.5") .set("Accept-Language", "en-US,en;q=0.5")
.build() .build()
val body = client.newCall(GET(url, newHeaders)).execute().use { it.body.string() } val body = client.newCall(GET(url, newHeaders)).execute().body.string()
val master = REGEX_MASTER_JS.find(body)?.groupValues?.get(1) ?: return emptyList() val master = REGEX_MASTER_JS.find(body)?.groupValues?.get(1) ?: return emptyList()
val aesJson = json.decodeFromString<CryptoInfo>(master) val aesJson = json.decodeFromString<CryptoInfo>(master)

View File

@ -34,7 +34,7 @@ class DailymotionExtractor(private val client: OkHttpClient, private val headers
private val playlistUtils by lazy { PlaylistUtils(client, headers) } private val playlistUtils by lazy { PlaylistUtils(client, headers) }
fun videosFromUrl(url: String, prefix: String = "Dailymotion - ", baseUrl: String = "", password: String? = null): List<Video> { fun videosFromUrl(url: String, prefix: String = "Dailymotion - ", baseUrl: String = "", password: String? = null): List<Video> {
val htmlString = client.newCall(GET(url)).execute().use { it.body.string() } val htmlString = client.newCall(GET(url)).execute().body.string()
val internalData = htmlString.substringAfter("\"dmInternalData\":").substringBefore("</script>") val internalData = htmlString.substringAfter("\"dmInternalData\":").substringBefore("</script>")
val ts = internalData.substringAfter("\"ts\":").substringBefore(",") val ts = internalData.substringAfter("\"ts\":").substringBefore(",")

View File

@ -23,7 +23,7 @@ class FastreamExtractor(private val client: OkHttpClient, private val headers: H
fun videosFromUrl(url: String, prefix: String = "Fastream:", needsSleep: Boolean = true): List<Video> { fun videosFromUrl(url: String, prefix: String = "Fastream:", needsSleep: Boolean = true): List<Video> {
return runCatching { return runCatching {
val firstDoc = client.newCall(GET(url, videoHeaders)).execute().use { it.asJsoup() } val firstDoc = client.newCall(GET(url, videoHeaders)).execute().asJsoup()
if (needsSleep) Thread.sleep(5100L) // 5s is the minimum if (needsSleep) Thread.sleep(5100L) // 5s is the minimum
@ -33,7 +33,7 @@ class FastreamExtractor(private val client: OkHttpClient, private val headers: H
add(it.attr("name"), it.attr("value")) add(it.attr("name"), it.attr("value"))
} }
}.build() }.build()
val doc = client.newCall(POST(url, videoHeaders, body = form)).execute().use { it.asJsoup() } val doc = client.newCall(POST(url, videoHeaders, body = form)).execute().asJsoup()
doc.selectFirst("script:containsData(jwplayer):containsData(vplayer)") ?: return emptyList() doc.selectFirst("script:containsData(jwplayer):containsData(vplayer)") ?: return emptyList()
} else { } else {
firstDoc.selectFirst("script:containsData(jwplayer):containsData(vplayer)") ?: return emptyList() firstDoc.selectFirst("script:containsData(jwplayer):containsData(vplayer)") ?: return emptyList()

View File

@ -24,7 +24,7 @@ class FilemoonExtractor(private val client: OkHttpClient) {
.set("Origin", "https://${httpUrl.host}") .set("Origin", "https://${httpUrl.host}")
.build() .build()
val doc = client.newCall(GET(url, videoHeaders)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url, videoHeaders)).execute().asJsoup()
val jsEval = doc.selectFirst("script:containsData(eval):containsData(m3u8)")!!.data() val jsEval = doc.selectFirst("script:containsData(eval):containsData(m3u8)")!!.data()
val unpacked = JsUnpacker.unpackAndCombine(jsEval).orEmpty() val unpacked = JsUnpacker.unpackAndCombine(jsEval).orEmpty()
val masterUrl = unpacked.takeIf(String::isNotBlank) val masterUrl = unpacked.takeIf(String::isNotBlank)
@ -42,7 +42,7 @@ class FilemoonExtractor(private val client: OkHttpClient) {
if (subUrl != null) { if (subUrl != null) {
runCatching { // to prevent failures on serialization errors runCatching { // to prevent failures on serialization errors
client.newCall(GET(subUrl, videoHeaders)).execute() client.newCall(GET(subUrl, videoHeaders)).execute()
.use { it.body.string() } .body.string()
.let { json.decodeFromString<List<SubtitleDto>>(it) } .let { json.decodeFromString<List<SubtitleDto>>(it) }
.forEach { add(Track(it.file, it.label)) } .forEach { add(Track(it.file, it.label)) }
} }

View File

@ -18,9 +18,9 @@ class FusevideoExtractor(private val client: OkHttpClient, private val headers:
.set("Host", url.toHttpUrl().host) .set("Host", url.toHttpUrl().host)
.set("Accept-Language", "en-US,en;q=0.5") .set("Accept-Language", "en-US,en;q=0.5")
.build() .build()
val document = client.newCall(GET(url, newHeaders)).execute().use { it.asJsoup() } val document = client.newCall(GET(url, newHeaders)).execute().asJsoup()
val dataUrl = document.selectFirst("script[src~=f/u/u/u/u]")?.attr("src")!! val dataUrl = document.selectFirst("script[src~=f/u/u/u/u]")?.attr("src")!!
val dataDoc = client.newCall(GET(dataUrl, newHeaders)).execute().use { it.body.string() } val dataDoc = client.newCall(GET(dataUrl, newHeaders)).execute().body.string()
val encoded = Regex("atob\\(\"(.*?)\"\\)").find(dataDoc)?.groupValues?.get(1)!! val encoded = Regex("atob\\(\"(.*?)\"\\)").find(dataDoc)?.groupValues?.get(1)!!
val data = Base64.decode(encoded, Base64.DEFAULT).toString(Charsets.UTF_8) val data = Base64.decode(encoded, Base64.DEFAULT).toString(Charsets.UTF_8)
val jsonData = data.split("|||")[1].replace("\\", "") val jsonData = data.split("|||")[1].replace("\\", "")

View File

@ -27,7 +27,7 @@ class GogoStreamExtractor(private val client: OkHttpClient) {
fun videosFromUrl(serverUrl: String): List<Video> { fun videosFromUrl(serverUrl: String): List<Video> {
return runCatching { return runCatching {
val document = client.newCall(GET(serverUrl)).execute().use { it.asJsoup() } val document = client.newCall(GET(serverUrl)).execute().asJsoup()
val iv = document.selectFirst("div.wrapper")!!.getBytesAfter("container-") val iv = document.selectFirst("div.wrapper")!!.getBytesAfter("container-")
val secretKey = document.selectFirst("body[class]")!!.getBytesAfter("container-") val secretKey = document.selectFirst("body[class]")!!.getBytesAfter("container-")
val decryptionKey = document.selectFirst("div.videocontent")!!.getBytesAfter("videocontent-") val decryptionKey = document.selectFirst("div.videocontent")!!.getBytesAfter("videocontent-")
@ -54,7 +54,7 @@ class GogoStreamExtractor(private val client: OkHttpClient) {
"XMLHttpRequest", "XMLHttpRequest",
), ),
), ),
).execute().use { it.body.string() } ).execute().body.string()
val data = json.decodeFromString<EncryptedDataDto>(jsonResponse).data val data = json.decodeFromString<EncryptedDataDto>(jsonResponse).data
val sourceList = cryptoHandler(data, iv, decryptionKey, false) val sourceList = cryptoHandler(data, iv, decryptionKey, false)

View File

@ -44,7 +44,7 @@ class GoogleDriveExtractor(private val client: OkHttpClient, private val headers
return videoFromRedirect(itemUrl, videoName, "", cookieJar) return videoFromRedirect(itemUrl, videoName, "", cookieJar)
} }
val document = docResp.use { it.asJsoup() } val document = docResp.asJsoup()
val itemSize = document.selectFirst("span.uc-name-size") val itemSize = document.selectFirst("span.uc-name-size")
?.let { " ${it.ownText().trim()} " } ?.let { " ${it.ownText().trim()} " }

View File

@ -38,7 +38,7 @@ object JavCoverFetcher {
return response return response
} }
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val targetUrl = document.selectFirst("#black-curtain-yes-button a")?.attr("abs:href") val targetUrl = document.selectFirst("#black-curtain-yes-button a")?.attr("abs:href")
?: throw IOException("Failed to bypass Amazon Age Gate") ?: throw IOException("Failed to bypass Amazon Age Gate")
@ -93,14 +93,14 @@ object JavCoverFetcher {
val response = CLIENT.newCall(request).execute() val response = CLIENT.newCall(request).execute()
var document = response.use { it.asJsoup() } var document = response.asJsoup()
// possibly multiple results or none // possibly multiple results or none
if (response.request.url.pathSegments.contains("vl_searchbyid.php")) { if (response.request.url.pathSegments.contains("vl_searchbyid.php")) {
val targetUrl = document.selectFirst(".videos a[href*=\"?v=\"]")?.attr("abs:href") val targetUrl = document.selectFirst(".videos a[href*=\"?v=\"]")?.attr("abs:href")
?: return null ?: return null
document = CLIENT.newCall(GET(targetUrl, HEADERS)).execute().use { it.asJsoup() } document = CLIENT.newCall(GET(targetUrl, HEADERS)).execute().asJsoup()
} }
val dirtyTitle = document.selectFirst(".post-title")?.text() val dirtyTitle = document.selectFirst(".post-title")?.text()
@ -121,7 +121,7 @@ object JavCoverFetcher {
val response = CLIENT.newCall(request).execute() val response = CLIENT.newCall(request).execute()
val document = response.use { it.asJsoup() } val document = response.asJsoup()
return document.selectFirst("a.result-link")?.attr("href") return document.selectFirst("a.result-link")?.attr("href")
} }
@ -131,7 +131,7 @@ object JavCoverFetcher {
val response = CLIENT.newCall(request).execute() val response = CLIENT.newCall(request).execute()
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val smallImage = document.selectFirst("#landingImage")?.attr("src") val smallImage = document.selectFirst("#landingImage")?.attr("src")

View File

@ -71,7 +71,7 @@ class MegaCloudExtractor(
} }
val script = noCacheClient.newCall(GET(scriptUrl, cache = cacheControl)) val script = noCacheClient.newCall(GET(scriptUrl, cache = cacheControl))
.execute() .execute()
.use { it.body.string() } .body.string()
val regex = val regex =
Regex("case\\s*0x[0-9a-f]+:(?![^;]*=partKey)\\s*\\w+\\s*=\\s*(\\w+)\\s*,\\s*\\w+\\s*=\\s*(\\w+);") Regex("case\\s*0x[0-9a-f]+:(?![^;]*=partKey)\\s*\\w+\\s*=\\s*(\\w+)\\s*,\\s*\\w+\\s*=\\s*(\\w+);")
val matches = regex.findAll(script).toList() val matches = regex.findAll(script).toList()
@ -147,7 +147,7 @@ class MegaCloudExtractor(
.substringBefore("?", "").ifEmpty { throw Exception("I HATE THE ANTICHRIST") } .substringBefore("?", "").ifEmpty { throw Exception("I HATE THE ANTICHRIST") }
val srcRes = client.newCall(GET(SERVER_URL[type] + SOURCES_URL[type] + id)) val srcRes = client.newCall(GET(SERVER_URL[type] + SOURCES_URL[type] + id))
.execute() .execute()
.use { it.body.string() } .body.string()
val data = json.decodeFromString<SourceResponseDto>(srcRes) val data = json.decodeFromString<SourceResponseDto>(srcRes)

View File

@ -18,7 +18,7 @@ class MixDropExtractor(private val client: OkHttpClient) {
referer: String = DEFAULT_REFERER, referer: String = DEFAULT_REFERER,
): List<Video> { ): List<Video> {
val headers = Headers.headersOf("Referer", referer) val headers = Headers.headersOf("Referer", referer)
val doc = client.newCall(GET(url, headers)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url, headers)).execute().asJsoup()
val unpacked = doc.selectFirst("script:containsData(eval):containsData(MDCore)") val unpacked = doc.selectFirst("script:containsData(eval):containsData(MDCore)")
?.data() ?.data()
?.let(Unpacker::unpack) ?.let(Unpacker::unpack)

View File

@ -13,7 +13,7 @@ class Mp4uploadExtractor(private val client: OkHttpClient) {
.set("referer", REFERER) .set("referer", REFERER)
.build() .build()
val doc = client.newCall(GET(url, newHeaders)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url, newHeaders)).execute().asJsoup()
val script = doc.selectFirst("script:containsData(eval):containsData(p,a,c,k,e,d)")?.data() val script = doc.selectFirst("script:containsData(eval):containsData(p,a,c,k,e,d)")?.data()
?.let(JsUnpacker::unpackAndCombine) ?.let(JsUnpacker::unpackAndCombine)

View File

@ -84,7 +84,7 @@ class PlaylistUtils(private val client: OkHttpClient, private val headers: Heade
val masterHeaders = masterHeadersGen(headers, referer) val masterHeaders = masterHeadersGen(headers, referer)
val masterPlaylist = client.newCall(GET(playlistUrl, masterHeaders)).execute() val masterPlaylist = client.newCall(GET(playlistUrl, masterHeaders)).execute()
.use { it.body.string() } .body.string()
// Check if there isn't multiple streams available // Check if there isn't multiple streams available
if (PLAYLIST_SEPARATOR !in masterPlaylist) { if (PLAYLIST_SEPARATOR !in masterPlaylist) {
@ -290,7 +290,7 @@ class PlaylistUtils(private val client: OkHttpClient, private val headers: Heade
val mpdHeaders = mpdHeadersGen(headers, referer) val mpdHeaders = mpdHeadersGen(headers, referer)
val doc = client.newCall(GET(mpdUrl, mpdHeaders)).execute() val doc = client.newCall(GET(mpdUrl, mpdHeaders)).execute()
.use { it.asJsoup() } .asJsoup()
// Get audio tracks // Get audio tracks
val audioTracks = audioList + doc.select("Representation[mimetype~=audio]").map { audioSrc -> val audioTracks = audioList + doc.select("Representation[mimetype~=audio]").map { audioSrc ->

View File

@ -12,7 +12,7 @@ class SendvidExtractor(private val client: OkHttpClient, private val headers: He
private val playlistUtils by lazy { PlaylistUtils(client, headers) } private val playlistUtils by lazy { PlaylistUtils(client, headers) }
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val document = client.newCall(GET(url, headers)).execute().use { it.asJsoup() } val document = client.newCall(GET(url, headers)).execute().asJsoup()
val masterUrl = document.selectFirst("source#video_source")?.attr("src") ?: return emptyList() val masterUrl = document.selectFirst("source#video_source")?.attr("src") ?: return emptyList()
return if (masterUrl.contains(".m3u8")) { return if (masterUrl.contains(".m3u8")) {

View File

@ -7,7 +7,7 @@ import okhttp3.OkHttpClient
class StreamDavExtractor(private val client: OkHttpClient) { class StreamDavExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val document = client.newCall(GET(url)).execute().use { it.asJsoup() } val document = client.newCall(GET(url)).execute().asJsoup()
return document.select("source").map { return document.select("source").map {
val videoUrl = it.attr("src") val videoUrl = it.attr("src")
val quality = it.attr("label") val quality = it.attr("label")

View File

@ -9,7 +9,7 @@ class StreamHubExtractor(private val client: OkHttpClient) {
private val playlistUtils by lazy { PlaylistUtils(client) } private val playlistUtils by lazy { PlaylistUtils(client) }
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val document = client.newCall(GET(url)).execute().use { it.body.string() } val document = client.newCall(GET(url)).execute().body.string()
val id = REGEX_ID.find(document)?.groupValues?.get(1) val id = REGEX_ID.find(document)?.groupValues?.get(1)
val sub = REGEX_SUB.find(document)?.groupValues?.get(1) val sub = REGEX_SUB.find(document)?.groupValues?.get(1)
val masterUrl = "https://$sub.streamhub.ink/hls/,$id,.urlset/master.m3u8" val masterUrl = "https://$sub.streamhub.ink/hls/,$id,.urlset/master.m3u8"

View File

@ -15,7 +15,7 @@ class StreamTapeExtractor(private val client: OkHttpClient) {
baseUrl + id baseUrl + id
} else { url } } else { url }
val document = client.newCall(GET(newUrl)).execute().use { it.asJsoup() } val document = client.newCall(GET(newUrl)).execute().asJsoup()
val targetLine = "document.getElementById('robotlink')" val targetLine = "document.getElementById('robotlink')"
val script = document.selectFirst("script:containsData($targetLine)") val script = document.selectFirst("script:containsData($targetLine)")
?.data() ?.data()

View File

@ -15,7 +15,7 @@ class StreamWishExtractor(private val client: OkHttpClient, private val headers:
fun videosFromUrl(url: String, videoNameGen: (String) -> String = { quality -> "StreamWish - $quality" }): List<Video> { fun videosFromUrl(url: String, videoNameGen: (String) -> String = { quality -> "StreamWish - $quality" }): List<Video> {
val doc = client.newCall(GET(url, headers)).execute() val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
// Sometimes the script body is packed, sometimes it isn't // Sometimes the script body is packed, sometimes it isn't
val scriptBody = doc.selectFirst("script:containsData(m3u8)")?.data() val scriptBody = doc.selectFirst("script:containsData(m3u8)")?.data()
?.let { script -> ?.let { script ->

View File

@ -8,7 +8,7 @@ import okhttp3.OkHttpClient
class UqloadExtractor(private val client: OkHttpClient) { class UqloadExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val doc = client.newCall(GET(url)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url)).execute().asJsoup()
val script = doc.selectFirst("script:containsData(sources:)")?.data() val script = doc.selectFirst("script:containsData(sources:)")?.data()
?: return emptyList() ?: return emptyList()

View File

@ -14,7 +14,7 @@ class VidoExtractor(private val client: OkHttpClient) {
private val playlistUtils by lazy { PlaylistUtils(client) } private val playlistUtils by lazy { PlaylistUtils(client) }
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val document = client.newCall(GET(url)).execute().use { it.body.string() } val document = client.newCall(GET(url)).execute().body.string()
val id = REGEX_ID.find(document)?.groupValues?.get(1) val id = REGEX_ID.find(document)?.groupValues?.get(1)
val masterUrl = "$VIDO_URL/hls/$id/master.m3u8" val masterUrl = "$VIDO_URL/hls/$id/master.m3u8"
return playlistUtils.extractFromHls(masterUrl, videoNameGen = { "${prefix}Vido - ($it)" }) return playlistUtils.extractFromHls(masterUrl, videoNameGen = { "${prefix}Vido - ($it)" })

View File

@ -27,14 +27,13 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
.cache(null) .cache(null)
.build() .build()
private val keys by lazy { private val keys by lazy {
noCacheClient.newCall( noCacheClient.newCall(
GET("https://raw.githubusercontent.com/KillerDogeEmpire/vidplay-keys/keys/keys.json", cache = cacheControl), GET("https://raw.githubusercontent.com/KillerDogeEmpire/vidplay-keys/keys/keys.json", cache = cacheControl),
).execute().parseAs<List<String>>() ).execute().parseAs<List<String>>()
} }
fun videosFromUrl(embedLink: String, hosterName: String, type: String = "" ): List<Video> { fun videosFromUrl(embedLink: String, hosterName: String, type: String = ""): List<Video> {
val host = embedLink.toHttpUrl().host val host = embedLink.toHttpUrl().host
val apiUrl = getApiUrl(embedLink, keys) val apiUrl = getApiUrl(embedLink, keys)
@ -64,7 +63,7 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
return playlistUtils.extractFromHls( return playlistUtils.extractFromHls(
data.result.sources.first().file, data.result.sources.first().file,
referer = "https://$host/", referer = "https://$host/",
videoNameGen = { q -> hosterName + (if(type.isBlank()) "" else " - $type") + " - $q" }, videoNameGen = { q -> hosterName + (if (type.isBlank()) "" else " - $type") + " - $q" },
subtitleList = data.result.tracks.toTracks(), subtitleList = data.result.tracks.toTracks(),
) )
} }
@ -114,7 +113,7 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
private fun callFromFuToken(host: String, data: String): String { private fun callFromFuToken(host: String, data: String): String {
val fuTokenScript = client.newCall( val fuTokenScript = client.newCall(
GET("https://$host/futoken"), GET("https://$host/futoken"),
).execute().use { it.body.string() } ).execute().body.string()
val js = buildString { val js = buildString {
append("(function") append("(function")

View File

@ -22,7 +22,7 @@ class VkExtractor(private val client: OkHttpClient, private val headers: Headers
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val data = client.newCall(GET(url, documentHeaders)).execute() val data = client.newCall(GET(url, documentHeaders)).execute()
.use { it.body.string() } .body.string()
return REGEX_VIDEO.findAll(data).map { return REGEX_VIDEO.findAll(data).map {
val quality = it.groupValues[1] val quality = it.groupValues[1]

View File

@ -7,7 +7,7 @@ import okhttp3.OkHttpClient
class VoeExtractor(private val client: OkHttpClient) { class VoeExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String? = null, prefix: String = ""): Video? { fun videoFromUrl(url: String, quality: String? = null, prefix: String = ""): Video? {
val document = client.newCall(GET(url)).execute().use { it.asJsoup() } val document = client.newCall(GET(url)).execute().asJsoup()
val script = document.selectFirst("script:containsData(const sources), script:containsData(var sources)") val script = document.selectFirst("script:containsData(const sources), script:containsData(var sources)")
?.data() ?.data()
?: return null ?: return null

View File

@ -10,7 +10,7 @@ import okhttp3.OkHttpClient
class VudeoExtractor(private val client: OkHttpClient) { class VudeoExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val doc = client.newCall(GET(url)).execute() val doc = client.newCall(GET(url)).execute()
.use { it.asJsoup() } .asJsoup()
val sources = doc.selectFirst("script:containsData(sources: [)")?.data() val sources = doc.selectFirst("script:containsData(sources: [)")?.data()
?: return emptyList() ?: return emptyList()

View File

@ -51,7 +51,7 @@ class AnimeBalkan : AnimeStream(
gdriveExtractor.videosFromUrl(newUrl) gdriveExtractor.videosFromUrl(newUrl)
} }
"Server AB" in name && baseUrl in url -> { "Server AB" in name && baseUrl in url -> {
val doc = client.newCall(GET(url)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url)).execute().asJsoup()
val videoUrl = doc.selectFirst("source")?.attr("src") val videoUrl = doc.selectFirst("source")?.attr("src")
?: return emptyList() ?: return emptyList()
listOf(Video(videoUrl, "Server AB - Default", videoUrl)) listOf(Video(videoUrl, "Server AB - Default", videoUrl))

View File

@ -17,7 +17,7 @@ class MailRuExtractor(private val client: OkHttpClient, private val headers: Hea
fun videosFromUrl(url: String): List<Video> { fun videosFromUrl(url: String): List<Video> {
val document = client.newCall(GET(url, headers)).execute() val document = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
val metaUrl = document.selectFirst("script:containsData(metadataUrl)") val metaUrl = document.selectFirst("script:containsData(metadataUrl)")
?.data() ?.data()
@ -35,7 +35,7 @@ class MailRuExtractor(private val client: OkHttpClient, private val headers: Hea
val metaResponse = client.newCall(GET(metaUrl, metaHeaders)).execute() val metaResponse = client.newCall(GET(metaUrl, metaHeaders)).execute()
val metaJson = json.decodeFromString<MetaResponse>( val metaJson = json.decodeFromString<MetaResponse>(
metaResponse.use { it.body.string() }, metaResponse.body.string(),
) )
val videoKey = metaResponse.headers.firstOrNull { val videoKey = metaResponse.headers.firstOrNull {

View File

@ -11,11 +11,11 @@ class VidMolyExtractor(private val client: OkHttpClient) {
fun getVideoList(url: String, lang: String): List<Video> { fun getVideoList(url: String, lang: String): List<Video> {
val body = client.newCall(GET(url)).execute() val body = client.newCall(GET(url)).execute()
.use { it.body.string() } .body.string()
val playlistUrl = regexPlaylist.find(body)!!.groupValues.get(1) val playlistUrl = regexPlaylist.find(body)!!.groupValues.get(1)
val headers = Headers.headersOf("Referer", "https://vidmoly.to") val headers = Headers.headersOf("Referer", "https://vidmoly.to")
val playlistData = client.newCall(GET(playlistUrl, headers)).execute() val playlistData = client.newCall(GET(playlistUrl, headers)).execute()
.use { it.body.string() } .body.string()
val separator = "#EXT-X-STREAM-INF:" val separator = "#EXT-X-STREAM-INF:"
return playlistData.substringAfter(separator).split(separator).map { return playlistData.substringAfter(separator).split(separator).map {

View File

@ -31,7 +31,7 @@ class YouTubeExtractor(private val client: OkHttpClient) {
val document = client.newCall(GET(url.replace("/embed/", "/watch?v="))) val document = client.newCall(GET(url.replace("/embed/", "/watch?v=")))
.execute() .execute()
.use { it.asJsoup() } .asJsoup()
val ytcfg = document.selectFirst("script:containsData(window.ytcfg=window.ytcfg)") val ytcfg = document.selectFirst("script:containsData(window.ytcfg=window.ytcfg)")
?.data() ?: run { ?.data() ?: run {
@ -81,7 +81,7 @@ class YouTubeExtractor(private val client: OkHttpClient) {
}.build() }.build()
val ytResponse = client.newCall(POST(playerUrl, headers, body)).execute() val ytResponse = client.newCall(POST(playerUrl, headers, body)).execute()
.use { json.decodeFromString<YoutubeResponse>(it.body.string()) } .let { json.decodeFromString<YoutubeResponse>(it.body.string()) }
val formats = ytResponse.streamingData.adaptiveFormats val formats = ytResponse.streamingData.adaptiveFormats

View File

@ -28,12 +28,12 @@ class ShittyProtectionInterceptor(private val client: OkHttpClient) : Intercepto
} }
private fun bypassProtection(request: Request, response: Response): Request { private fun bypassProtection(request: Request, response: Response): Request {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val script = doc.selectFirst("script:containsData(slowAES)")!!.data() val script = doc.selectFirst("script:containsData(slowAES)")!!.data()
val slowAES = doc.selectFirst("script[src*=min.js]")!!.attr("abs:src").let { url -> val slowAES = doc.selectFirst("script[src*=min.js]")!!.attr("abs:src").let { url ->
client.newCall(GET(url)).execute().use { it.body.string() } client.newCall(GET(url)).execute().body.string()
} }
val patchedScript = slowAES + "\n" + ADDITIONAL_FUNCTIONS + script val patchedScript = slowAES + "\n" + ADDITIONAL_FUNCTIONS + script

View File

@ -14,7 +14,7 @@ class VatchusExtractor(private val client: OkHttpClient, private val headers: He
fun videosFromUrl(url: String, prefix: String): List<Video> { fun videosFromUrl(url: String, prefix: String): List<Video> {
val doc = client.newCall(GET(url, headers)).execute() val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
val script = doc.selectFirst("script:containsData(document.write)") val script = doc.selectFirst("script:containsData(document.write)")
?.data() ?.data()

View File

@ -22,7 +22,7 @@ class StreamPlayExtractor(private val client: OkHttpClient, private val headers:
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val document = client.newCall( val document = client.newCall(
GET(url, headers), GET(url, headers),
).execute().use { it.asJsoup() } ).execute().asJsoup()
val apiUrl = document.selectFirst("script:containsData(/api/)") val apiUrl = document.selectFirst("script:containsData(/api/)")
?.data() ?.data()

View File

@ -22,7 +22,7 @@ class LMAnime : AnimeStream(
override val prefQualityEntries = prefQualityValues override val prefQualityEntries = prefQualityValues
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val items = response.use { it.asJsoup() }.select(videoListSelector()) val items = response.asJsoup().select(videoListSelector())
val allowed = preferences.getStringSet(PREF_ALLOWED_LANGS_KEY, PREF_ALLOWED_LANGS_DEFAULT)!! val allowed = preferences.getStringSet(PREF_ALLOWED_LANGS_KEY, PREF_ALLOWED_LANGS_DEFAULT)!!
return items return items
.filter { element -> .filter { element ->

View File

@ -28,12 +28,12 @@ class ShittyProtectionInterceptor(private val client: OkHttpClient) : Intercepto
} }
private fun bypassProtection(request: Request, response: Response): Request { private fun bypassProtection(request: Request, response: Response): Request {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val script = doc.selectFirst("script:containsData(slowAES)")!!.data() val script = doc.selectFirst("script:containsData(slowAES)")!!.data()
val slowAES = doc.selectFirst("script[src*=min.js]")!!.attr("abs:src").let { url -> val slowAES = doc.selectFirst("script[src*=min.js]")!!.attr("abs:src").let { url ->
client.newCall(GET(url)).execute().use { it.body.string() } client.newCall(GET(url)).execute().body.string()
} }
val patchedScript = slowAES + "\n" + ADDITIONAL_FUNCTIONS + script val patchedScript = slowAES + "\n" + ADDITIONAL_FUNCTIONS + script

View File

@ -126,7 +126,7 @@ class TRAnimeCI : AnimeStream(
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val script = doc.selectFirst("script:containsData(let video_source)")!!.data() val script = doc.selectFirst("script:containsData(let video_source)")!!.data()
return script.substringAfter("[").substringBefore("]") return script.substringAfter("[").substringBefore("]")
.split("{") .split("{")

View File

@ -135,7 +135,7 @@ class AnimeOnlineNinja : DooPlay(
uqloadExtractor.videosFromUrl(url) uqloadExtractor.videosFromUrl(url)
"wolfstream" in url -> { "wolfstream" in url -> {
client.newCall(GET(url, headers)).execute() client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
.selectFirst("script:containsData(sources)") .selectFirst("script:containsData(sources)")
?.data() ?.data()
?.let { jsData -> ?.let { jsData ->
@ -176,7 +176,7 @@ class AnimeOnlineNinja : DooPlay(
val num = player.attr("data-nume") val num = player.attr("data-nume")
return client.newCall(GET("$baseUrl/wp-json/dooplayer/v1/post/$id?type=$type&source=$num")) return client.newCall(GET("$baseUrl/wp-json/dooplayer/v1/post/$id?type=$type&source=$num"))
.execute() .execute()
.use { response -> .let { response ->
response.body.string() response.body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")

View File

@ -31,7 +31,7 @@ class AnimePlayer : DooPlay(
private val bloggerExtractor by lazy { BloggerExtractor(client) } private val bloggerExtractor by lazy { BloggerExtractor(client) }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val playerUrl = response.use { it.asJsoup() } val playerUrl = response.asJsoup()
.selectFirst("div.playex iframe") .selectFirst("div.playex iframe")
?.attr("abs:src") ?.attr("abs:src")
?.toHttpUrlOrNull() ?.toHttpUrlOrNull()

View File

@ -21,7 +21,7 @@ class AnimeSAGA : DooPlay(
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val playerUrls = response.use { it.asJsoup() } val playerUrls = response.asJsoup()
.select("ul#playeroptionsul li:not([id=player-option-trailer])") .select("ul#playeroptionsul li:not([id=player-option-trailer])")
.map(::getPlayerUrl) .map(::getPlayerUrl)
@ -51,9 +51,9 @@ class AnimeSAGA : DooPlay(
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body)) return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute() .execute()
.use { response -> .let { response ->
response response
.use { it.body.string() } .body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")
.replace("\\", "") .replace("\\", "")

View File

@ -53,20 +53,19 @@ class AnimesFoxBR : DooPlay(
} }
private fun extractVideos(url: String, language: String): List<Video> { private fun extractVideos(url: String, language: String): List<Video> {
return client.newCall(GET(url, headers)).execute() return client.newCall(GET(url, headers)).execute().let { response ->
.use { response -> response.body.string()
response.body.string() .substringAfter("sources:[")
.substringAfter("sources:[") .substringBefore("]")
.substringBefore("]") .split("},")
.split("},") .mapNotNull {
.mapNotNull { val videoUrl = it.substringAfter("file: \"")
val videoUrl = it.substringAfter("file: \"") .substringBefore('"')
.substringBefore('"') .ifBlank { return@mapNotNull null }
.ifBlank { return@mapNotNull null } val quality = it.substringAfter("label:\"").substringBefore('"')
val quality = it.substringAfter("label:\"").substringBefore('"') Video(videoUrl, "$language($quality)", videoUrl, headers = headers)
Video(videoUrl, "$language($quality)", videoUrl, headers = headers) }
} }
}
} }
private fun getPlayerUrl(player: Element): String { private fun getPlayerUrl(player: Element): String {
@ -79,7 +78,7 @@ class AnimesFoxBR : DooPlay(
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body)) return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute() .execute()
.use { response -> .let { response ->
response.body.string() response.body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")

View File

@ -100,7 +100,7 @@ class AnimesOnline : DooPlay(
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body)) return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute() .execute()
.use { response -> .let { response ->
response.body.string() response.body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")
@ -140,7 +140,7 @@ class AnimesOnline : DooPlay(
return document.selectFirst("div.pag_episodes div.item > a:has(i.fa-th)")?.let { return document.selectFirst("div.pag_episodes div.item > a:has(i.fa-th)")?.let {
client.newCall(GET(it.attr("href"), headers)).execute() client.newCall(GET(it.attr("href"), headers)).execute()
.use { req -> req.asJsoup() } .asJsoup()
} ?: document } ?: document
} }
} }

View File

@ -7,7 +7,7 @@ import okhttp3.OkHttpClient
class AnimesOnlinePlayerExtractor(private val client: OkHttpClient) { class AnimesOnlinePlayerExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String): List<Video> { fun videosFromUrl(url: String): List<Video> {
return client.newCall(GET(url)).execute() return client.newCall(GET(url)).execute()
.use { it.body.string() } .body.string()
.substringAfter("sources: [") .substringAfter("sources: [")
.substringBefore("]") .substringBefore("]")
.split("{") .split("{")

View File

@ -8,7 +8,7 @@ import okhttp3.OkHttpClient
class RuplayExtractor(private val client: OkHttpClient) { class RuplayExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String): List<Video> { fun videosFromUrl(url: String): List<Video> {
return client.newCall(GET(url)).execute() return client.newCall(GET(url)).execute()
.use { it.body.string() } .body.string()
.substringAfter("Playerjs({") .substringAfter("Playerjs({")
.substringAfter("file:\"") .substringAfter("file:\"")
.substringBefore("\"") .substringBefore("\"")

View File

@ -44,7 +44,7 @@ class AnimesHouse : DooPlay(
.build() .build()
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body)) return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute() .execute()
.use { it.asJsoup().selectFirst("iframe")!!.attr("src") } .asJsoup().selectFirst("iframe")!!.attr("src")
.let { .let {
when { when {
it.contains("/redplay") -> { it.contains("/redplay") -> {
@ -57,7 +57,7 @@ class AnimesHouse : DooPlay(
} }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val players = response.use { it.asJsoup().select("ul#playeroptionsul li") } val players = response.asJsoup().select("ul#playeroptionsul li")
return players.flatMap { player -> return players.flatMap { player ->
runCatching { runCatching {
val url = getPlayerUrl(player) val url = getPlayerUrl(player)
@ -74,7 +74,7 @@ class AnimesHouse : DooPlay(
private fun getPlayerVideos(url: String): List<Video> { private fun getPlayerVideos(url: String): List<Video> {
val iframeBody = client.newCall(GET(url, headers)).execute() val iframeBody = client.newCall(GET(url, headers)).execute()
.use { it.body.string() } .body.string()
val unpackedBody = JsUnpacker.unpack(iframeBody) val unpackedBody = JsUnpacker.unpack(iframeBody)

View File

@ -17,7 +17,7 @@ class McpExtractor(
val epId = regexEpId.find(js)!!.groupValues[1] val epId = regexEpId.find(js)!!.groupValues[1]
val videoUrl = client.newCall(GET("$apiUrl/s_control.php?mid=$epId", headers)) val videoUrl = client.newCall(GET("$apiUrl/s_control.php?mid=$epId", headers))
.execute() .execute()
.use { req -> .let { req ->
val reqBody = req.body.string() val reqBody = req.body.string()
regexVideoUrl.find(reqBody)!!.groupValues regexVideoUrl.find(reqBody)!!.groupValues
.get(1) .get(1)

View File

@ -15,8 +15,8 @@ class RedplayBypasser(
) { ) {
fun fromUrl(url: String): String { fun fromUrl(url: String): String {
val linkUrl = client.newCall(GET(url, headers)).execute() val linkUrl = client.newCall(GET(url, headers)).execute().asJsoup()
.use { it.asJsoup().selectFirst("a")!!.attr("href") } .selectFirst("a")!!.attr("href")
val newHeaders = headers.newBuilder().set("Referer", linkUrl).build() val newHeaders = headers.newBuilder().set("Referer", linkUrl).build()
@ -24,25 +24,23 @@ class RedplayBypasser(
return getIframeUrl(response, newHeaders) return getIframeUrl(response, newHeaders)
} }
private fun getIframeUrl(response: Response, newHeaders: Headers): String { private fun getIframeUrl(page: Response, newHeaders: Headers): String {
return response.use { page -> val document = page.asJsoup(decodeAtob(page.body.string()))
val document = page.asJsoup(decodeAtob(page.body.string())) val iframe = document.selectFirst("iframe")
val iframe = document.selectFirst("iframe") return if (iframe != null) {
if (iframe != null) { iframe.attr("src")
iframe.attr("src") } else {
} else { val formUrl = document.selectFirst("form")!!.attr("action")
val formUrl = document.selectFirst("form")!!.attr("action")
val formBody = FormBody.Builder().apply { val formBody = FormBody.Builder().apply {
document.select("input[name]").forEach { document.select("input[name]").forEach {
add(it.attr("name"), it.attr("value")) add(it.attr("name"), it.attr("value"))
} }
}.build() }.build()
client.newCall(POST(formUrl, newHeaders, formBody)) client.newCall(POST(formUrl, newHeaders, formBody))
.execute() .execute()
.let { getIframeUrl(it, newHeaders) } .let { getIframeUrl(it, newHeaders) }
}
} }
} }

View File

@ -45,7 +45,7 @@ class Cinemathek : DooPlay(
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val players = response.use { it.asJsoup().select("ul#playeroptionsul li") } val players = response.asJsoup().select("ul#playeroptionsul li")
val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!! val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!!
return players.parallelCatchingFlatMapBlocking { player -> return players.parallelCatchingFlatMapBlocking { player ->
val url = getPlayerUrl(player).takeUnless(String::isEmpty)!! val url = getPlayerUrl(player).takeUnless(String::isEmpty)!!
@ -60,7 +60,7 @@ class Cinemathek : DooPlay(
if (num == "trailer") return "" if (num == "trailer") return ""
return client.newCall(GET("$baseUrl/wp-json/dooplayer/v2/$id/$type/$num")) return client.newCall(GET("$baseUrl/wp-json/dooplayer/v2/$id/$type/$num"))
.await() .await()
.use { it.body.string() } .body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")
.replace("\\", "") .replace("\\", "")

View File

@ -41,7 +41,7 @@ class GoAnimes : DooPlay(
val url = season.attr("href") val url = season.attr("href")
return client.newCall(GET(url, headers)) return client.newCall(GET(url, headers))
.execute() .execute()
.use { it.asJsoup() } .asJsoup()
.let(::getSeasonEpisodes) .let(::getSeasonEpisodes)
} }
@ -55,7 +55,7 @@ class GoAnimes : DooPlay(
doc.selectFirst(episodeListNextPageSelector)?.let { doc.selectFirst(episodeListNextPageSelector)?.let {
val url = it.attr("abs:href") val url = it.attr("abs:href")
doc = client.newCall(GET(url, headers)).execute() doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
} }
} }
addAll(super.getSeasonEpisodes(doc)) addAll(super.getSeasonEpisodes(doc))
@ -74,7 +74,7 @@ class GoAnimes : DooPlay(
private val playlistUtils by lazy { PlaylistUtils(client, headers) } private val playlistUtils by lazy { PlaylistUtils(client, headers) }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val players = document.select("ul#playeroptionsul li") val players = document.select("ul#playeroptionsul li")
return players.parallelCatchingFlatMapBlocking(::getPlayerVideos) return players.parallelCatchingFlatMapBlocking(::getPlayerVideos)
} }
@ -93,7 +93,7 @@ class GoAnimes : DooPlay(
.build() .build()
val script = client.newCall(GET(url, headers)).await() val script = client.newCall(GET(url, headers)).await()
.use { it.body.string() } .body.string()
.let { JsDecoder.decodeScript(it, false).ifBlank { it } } .let { JsDecoder.decodeScript(it, false).ifBlank { it } }
script.substringAfter("sources: [") script.substringAfter("sources: [")
@ -128,7 +128,7 @@ class GoAnimes : DooPlay(
} }
listOf("/bloggerjwplayer", "/m3u8", "/multivideo").any { it in url } -> { listOf("/bloggerjwplayer", "/m3u8", "/multivideo").any { it in url } -> {
val script = client.newCall(GET(url)).await() val script = client.newCall(GET(url)).await()
.use { it.body.string() } .body.string()
.let(JsDecoder::decodeScript) .let(JsDecoder::decodeScript)
when { when {
"/bloggerjwplayer" in url -> "/bloggerjwplayer" in url ->
@ -155,7 +155,7 @@ class GoAnimes : DooPlay(
val num = player.attr("data-nume") val num = player.attr("data-nume")
val url = client.newCall(GET("$baseUrl/wp-json/dooplayer/v2/$id/$type/$num")) val url = client.newCall(GET("$baseUrl/wp-json/dooplayer/v2/$id/$type/$num"))
.await() .await()
.use { it.body.string() } .body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")
.replace("\\", "") .replace("\\", "")
@ -163,7 +163,7 @@ class GoAnimes : DooPlay(
return when { return when {
"/protetorlinks/" in url -> { "/protetorlinks/" in url -> {
val link = client.newCall(GET(url)).await() val link = client.newCall(GET(url)).await()
.use { it.asJsoup() } .asJsoup()
.selectFirst("a[href]")!!.attr("href") .selectFirst("a[href]")!!.attr("href")
client.newCall(GET(link)).await() client.newCall(GET(link)).await()

View File

@ -14,7 +14,7 @@ class GoAnimesExtractor(private val client: OkHttpClient, private val headers: H
fun videosFromUrl(url: String, name: String): List<Video> { fun videosFromUrl(url: String, name: String): List<Video> {
val body = client.newCall(GET(url, headers)).execute() val body = client.newCall(GET(url, headers)).execute()
.use { it.body.string() } .body.string()
return when { return when {
"better-go.fun/player.php" in url || "/profix/player.php" in url -> "better-go.fun/player.php" in url || "/profix/player.php" in url ->
PlaylistExtractor.videosFromScript(body, name.split('-').first().trim()) PlaylistExtractor.videosFromScript(body, name.split('-').first().trim())

View File

@ -9,31 +9,29 @@ import okhttp3.OkHttpClient
import okhttp3.Response import okhttp3.Response
class LinkfunBypasser(private val client: OkHttpClient) { class LinkfunBypasser(private val client: OkHttpClient) {
fun getIframeUrl(response: Response): String { fun getIframeUrl(page: Response): String {
return response.use { page -> val docString = page.body.string()
val docString = page.body.string() val document = if (docString.startsWith("<script")) {
val document = if (docString.startsWith("<script")) { page.asJsoup(decodeAtob(docString))
page.asJsoup(decodeAtob(docString)) } else { page.asJsoup(docString) }
} else { page.asJsoup(docString) }
val newHeaders = Headers.headersOf("Referer", document.location()) val newHeaders = Headers.headersOf("Referer", document.location())
val iframe = document.selectFirst("iframe[src]") val iframe = document.selectFirst("iframe[src]")
if (iframe != null) { return if (iframe != null) {
iframe.attr("src") iframe.attr("src")
} else { } else {
val formBody = FormBody.Builder().apply { val formBody = FormBody.Builder().apply {
document.select("input[name]").forEach { document.select("input[name]").forEach {
add(it.attr("name"), it.attr("value")) add(it.attr("name"), it.attr("value"))
} }
}.build() }.build()
val formUrl = document.selectFirst("form")!!.attr("action") val formUrl = document.selectFirst("form")!!.attr("action")
client.newCall(POST(formUrl, newHeaders, formBody)) client.newCall(POST(formUrl, newHeaders, formBody))
.execute() .execute()
.use(::getIframeUrl) .let(::getIframeUrl)
}
} }
} }

View File

@ -54,7 +54,7 @@ class Kinoking : DooPlay(
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val players = response.use { it.asJsoup().select("li.dooplay_player_option") } val players = response.asJsoup().select("li.dooplay_player_option")
val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!! val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!!
return players.flatMap { player -> return players.flatMap { player ->
runCatching { runCatching {
@ -73,7 +73,7 @@ class Kinoking : DooPlay(
.build() .build()
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body)) return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute() .execute()
.use { response -> .let { response ->
response.body.string() response.body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")

View File

@ -52,7 +52,7 @@ class Multimovies : DooPlay(
override val seasonListSelector = "div#seasons > div:not(:contains(no episodes this season))" override val seasonListSelector = "div#seasons > div:not(:contains(no episodes this season))"
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val doc = response.use { getRealAnimeDoc(it.asJsoup()) } val doc = getRealAnimeDoc(response.asJsoup())
val seasonList = doc.select(seasonListSelector) val seasonList = doc.select(seasonListSelector)
return if ("/movies/" in doc.location()) { return if ("/movies/" in doc.location()) {
SEpisode.create().apply { SEpisode.create().apply {
@ -105,7 +105,7 @@ class Multimovies : DooPlay(
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body)) return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute() .execute()
.use { response -> .let { response ->
response.body.string() response.body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")

View File

@ -27,7 +27,7 @@ class PiFansubs : DooPlay(
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val players = document.select("div.source-box:not(#source-player-trailer) iframe") val players = document.select("div.source-box:not(#source-player-trailer) iframe")
return players.map(::getPlayerUrl).flatMap(::getPlayerVideos) return players.map(::getPlayerUrl).flatMap(::getPlayerVideos)
} }

View File

@ -15,7 +15,7 @@ class BlembedExtractor(private val client: OkHttpClient, private val headers: He
fun videosFromUrl(url: String): List<Video> { fun videosFromUrl(url: String): List<Video> {
val doc = client.newCall(GET(url, headers)).execute() val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
val script = doc.selectFirst("script:containsData(player =)") val script = doc.selectFirst("script:containsData(player =)")
?.data() ?.data()

View File

@ -34,7 +34,7 @@ class Pobreflix : DooPlay(
private val superflixExtractor by lazy { SuperFlixExtractor(client, headers, ::genericExtractor) } private val superflixExtractor by lazy { SuperFlixExtractor(client, headers, ::genericExtractor) }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
return doc.select("div.source-box > a").flatMap { return doc.select("div.source-box > a").flatMap {
runCatching { runCatching {
val data = it.attr("href").toHttpUrl().queryParameter("auth") val data = it.attr("href").toHttpUrl().queryParameter("auth")

View File

@ -30,12 +30,11 @@ class EplayerExtractor(private val client: OkHttpClient) {
.add("r", "") .add("r", "")
.build() .build()
val masterUrl = client.newCall(POST(postUrl, headers, body = body)).execute().use { val masterUrl = client.newCall(POST(postUrl, headers, body = body)).execute()
it.body.string() .body.string()
.substringAfter("videoSource\":\"") .substringAfter("videoSource\":\"")
.substringBefore('"') .substringBefore('"')
.replace("\\", "") .replace("\\", "")
}
return playlistUtils.extractFromHls(masterUrl, videoNameGen = { "[$lang] EmbedPlayer - $it" }) return playlistUtils.extractFromHls(masterUrl, videoNameGen = { "[$lang] EmbedPlayer - $it" })
} }

View File

@ -16,7 +16,7 @@ class MyStreamExtractor(private val client: OkHttpClient, private val headers: H
return runCatching { return runCatching {
val response = client.newCall(GET(url, headers)).execute() val response = client.newCall(GET(url, headers)).execute()
val body = response.use { it.body.string() } val body = response.body.string()
val codePart = body val codePart = body
.substringAfter("sniff(") // Video function .substringAfter("sniff(") // Video function

View File

@ -43,7 +43,7 @@ class SuperFlixExtractor(
.set("origin", API_DOMAIN) .set("origin", API_DOMAIN)
.build() .build()
val doc = client.newCall(GET(url, headers)).await().use { it.asJsoup() } val doc = client.newCall(GET(url, headers)).await().asJsoup()
val baseUrl = "https://" + httpUrl.host val baseUrl = "https://" + httpUrl.host
val apiUrl = "$baseUrl/ajax_sources.php" val apiUrl = "$baseUrl/ajax_sources.php"
@ -65,7 +65,7 @@ class SuperFlixExtractor(
.build() .build()
val req = client.newCall(POST(apiUrl, apiHeaders, formBody)).await() val req = client.newCall(POST(apiUrl, apiHeaders, formBody)).await()
.use { it.body.string() } .body.string()
runCatching { runCatching {
val iframeUrl = json.decodeFromString<PlayerLinkDto>(req).iframe!! val iframeUrl = json.decodeFromString<PlayerLinkDto>(req).iframe!!
@ -82,7 +82,7 @@ class SuperFlixExtractor(
data class PlayerLinkDto(val iframe: String? = null) data class PlayerLinkDto(val iframe: String? = null)
private fun linksFromUrl(url: String): List<Pair<String, String>> { private fun linksFromUrl(url: String): List<Pair<String, String>> {
val doc = client.newCall(GET(url, defaultHeaders)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url, defaultHeaders)).execute().asJsoup()
val items = doc.select("div.select_language").mapNotNull { val items = doc.select("div.select_language").mapNotNull {
val target = it.attr("data-target") val target = it.attr("data-target")
@ -113,7 +113,7 @@ class SuperFlixExtractor(
.build() .build()
val res = client.newCall(POST("$API_DOMAIN/api", headers, body)).execute() val res = client.newCall(POST("$API_DOMAIN/api", headers, body)).execute()
.use { it.body.string() } .body.string()
return json.decodeFromString<ApiResponseDto>(res).data?.video_url return json.decodeFromString<ApiResponseDto>(res).data?.video_url
} }

View File

@ -76,7 +76,7 @@ class VoirCartoon : DooPlay(
// ============================== Episodes ============================== // ============================== Episodes ==============================
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val episodeList = doc.select(episodeListSelector()) val episodeList = doc.select(episodeListSelector())
return if (episodeList.size < 1) { return if (episodeList.size < 1) {
SEpisode.create().apply { SEpisode.create().apply {
@ -106,7 +106,7 @@ class VoirCartoon : DooPlay(
private val comedyshowExtractor by lazy { ComedyShowExtractor(client) } private val comedyshowExtractor by lazy { ComedyShowExtractor(client) }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val id = doc.selectFirst("input[name=idpost]")?.attr("value") ?: return emptyList() val id = doc.selectFirst("input[name=idpost]")?.attr("value") ?: return emptyList()
val players = doc.select("nav.player select > option").toList() val players = doc.select("nav.player select > option").toList()
@ -115,7 +115,7 @@ class VoirCartoon : DooPlay(
val urls = players.map { val urls = players.map {
client.newCall(GET("$baseUrl/ajax-get-link-stream/?server=$it&filmId=$id", headers)).execute() client.newCall(GET("$baseUrl/ajax-get-link-stream/?server=$it&filmId=$id", headers)).execute()
.use { it.body.string() } .body.string()
}.distinct() }.distinct()
return urls.flatMap { url -> return urls.flatMap { url ->

View File

@ -31,12 +31,11 @@ class ComedyShowExtractor(private val client: OkHttpClient) {
.add("r", "") .add("r", "")
.build() .build()
val masterUrl = client.newCall(POST(postUrl, headers, body = body)).execute().use { val masterUrl = client.newCall(POST(postUrl, headers, body = body)).execute()
it.body.string() .body.string()
.substringAfter("videoSource\":\"") .substringAfter("videoSource\":\"")
.substringBefore('"') .substringBefore('"')
.replace("\\", "") .replace("\\", "")
}
return playlistUtils.extractFromHls(masterUrl, videoNameGen = { "ComedyShow - $it" }) return playlistUtils.extractFromHls(masterUrl, videoNameGen = { "ComedyShow - $it" })
} }

View File

@ -117,7 +117,7 @@ abstract class AnimeStream(
} }
protected open fun searchAnimeByPathParse(response: Response): AnimesPage { protected open fun searchAnimeByPathParse(response: Response): AnimesPage {
val details = animeDetailsParse(response.use { it.asJsoup() }) val details = animeDetailsParse(response.asJsoup())
return AnimesPage(listOf(details), false) return AnimesPage(listOf(details), false)
} }
@ -162,7 +162,7 @@ abstract class AnimeStream(
AnimeStreamFilters.filterElements = runBlocking { AnimeStreamFilters.filterElements = runBlocking {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
client.newCall(GET(animeListUrl)).execute() client.newCall(GET(animeListUrl)).execute()
.use { it.asJsoup() } .asJsoup()
.select(filtersSelector) .select(filtersSelector)
} }
} }
@ -285,7 +285,7 @@ abstract class AnimeStream(
// ============================== Episodes ============================== // ============================== Episodes ==============================
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
return doc.select(episodeListSelector()).map(::episodeFromElement) return doc.select(episodeListSelector()).map(::episodeFromElement)
} }
@ -315,7 +315,7 @@ abstract class AnimeStream(
override fun videoListSelector() = "select.mirror > option[data-index], ul.mirror a[data-em]" override fun videoListSelector() = "select.mirror > option[data-index], ul.mirror a[data-em]"
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val items = response.use { it.asJsoup() }.select(videoListSelector()) val items = response.asJsoup().select(videoListSelector())
return items.parallelCatchingFlatMapBlocking { element -> return items.parallelCatchingFlatMapBlocking { element ->
val name = element.text() val name = element.text()
val url = getHosterUrl(element) val url = getHosterUrl(element)
@ -340,7 +340,7 @@ abstract class AnimeStream(
.let(::String) // bytearray -> string .let(::String) // bytearray -> string
.let(Jsoup::parse) // string -> document .let(Jsoup::parse) // string -> document
} else { } else {
client.newCall(GET(encodedData, headers)).execute().use { it.asJsoup() } client.newCall(GET(encodedData, headers)).execute().asJsoup()
} }
return doc.selectFirst("iframe[src~=.]")?.safeUrl() return doc.selectFirst("iframe[src~=.]")?.safeUrl()

View File

@ -134,7 +134,7 @@ abstract class DataLifeEngine(
override suspend fun getAnimeDetails(anime: SAnime): SAnime { override suspend fun getAnimeDetails(anime: SAnime): SAnime {
return client.newCall(animeDetailsRequest(anime)) return client.newCall(animeDetailsRequest(anime))
.awaitSuccess() .awaitSuccess()
.use { response -> .let { response ->
animeDetailsParse(response, anime).apply { initialized = true } animeDetailsParse(response, anime).apply { initialized = true }
} }
} }

View File

@ -101,7 +101,7 @@ abstract class DooPlay(
} }
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val doc = response.use { getRealAnimeDoc(it.asJsoup()) } val doc = getRealAnimeDoc(response.asJsoup())
val seasonList = doc.select(seasonListSelector) val seasonList = doc.select(seasonListSelector)
return if (seasonList.size < 1) { return if (seasonList.size < 1) {
SEpisode.create().apply { SEpisode.create().apply {

View File

@ -128,7 +128,7 @@ abstract class DopeFlix(
override fun episodeListSelector() = throw UnsupportedOperationException() override fun episodeListSelector() = throw UnsupportedOperationException()
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val infoElement = document.selectFirst("div.detail_page-watch")!! val infoElement = document.selectFirst("div.detail_page-watch")!!
val id = infoElement.attr("data-id") val id = infoElement.attr("data-id")
val dataType = infoElement.attr("data-type") // Tv = 2 or movie = 1 val dataType = infoElement.attr("data-type") // Tv = 2 or movie = 1
@ -139,7 +139,7 @@ abstract class DopeFlix(
seasonUrl, seasonUrl,
headers = Headers.headersOf("Referer", document.location()), headers = Headers.headersOf("Referer", document.location()),
), ),
).execute().use { it.asJsoup() } ).execute().asJsoup()
seasonsHtml seasonsHtml
.select("a.dropdown-item.ss-item") .select("a.dropdown-item.ss-item")
.flatMap(::parseEpisodesFromSeries) .flatMap(::parseEpisodesFromSeries)
@ -161,7 +161,7 @@ abstract class DopeFlix(
val seasonName = element.text() val seasonName = element.text()
val episodesUrl = "$baseUrl/ajax/v2/season/episodes/$seasonId" val episodesUrl = "$baseUrl/ajax/v2/season/episodes/$seasonId"
val episodesHtml = client.newCall(GET(episodesUrl)).execute() val episodesHtml = client.newCall(GET(episodesUrl)).execute()
.use { it.asJsoup() } .asJsoup()
val episodeElements = episodesHtml.select("div.eps-item") val episodeElements = episodesHtml.select("div.eps-item")
return episodeElements.map { episodeFromElement(it, seasonName) } return episodeElements.map { episodeFromElement(it, seasonName) }
} }
@ -190,7 +190,7 @@ abstract class DopeFlix(
val id = server.attr("data-id") val id = server.attr("data-id")
val url = "$baseUrl/ajax/sources/$id" val url = "$baseUrl/ajax/sources/$id"
val reqBody = client.newCall(GET(url, episodeReferer)).execute() val reqBody = client.newCall(GET(url, episodeReferer)).execute()
.use { it.body.string() } .body.string()
val sourceUrl = reqBody.substringAfter("\"link\":\"") val sourceUrl = reqBody.substringAfter("\"link\":\"")
.substringBefore("\"") .substringBefore("\"")
when { when {

View File

@ -31,7 +31,7 @@ class DopeFlixExtractor(private val client: OkHttpClient) {
} }
private fun generateIndexPairs(): List<List<Int>> { private fun generateIndexPairs(): List<List<Int>> {
val script = client.newCall(GET(SCRIPT_URL)).execute().use { it.body.string() } val script = client.newCall(GET(SCRIPT_URL)).execute().body.string()
return script.substringAfter("const ") return script.substringAfter("const ")
.substringBefore("()") .substringBefore("()")
.substringBeforeLast(",") .substringBeforeLast(",")

View File

@ -129,7 +129,7 @@ class AnimeWorldIndia(
} }
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val isMovie = document.selectFirst("nav li > a[href*=\"type/movies/\"]") != null val isMovie = document.selectFirst("nav li > a[href*=\"type/movies/\"]") != null
val seasonsJson = json.decodeFromString<List<SeasonDto>>( val seasonsJson = json.decodeFromString<List<SeasonDto>>(
@ -189,7 +189,7 @@ class AnimeWorldIndia(
private val mystreamExtractor by lazy { MyStreamExtractor(client, headers) } private val mystreamExtractor by lazy { MyStreamExtractor(client, headers) }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val body = response.use { it.body.string() } val body = response.body.string()
val documentTrimmed = body val documentTrimmed = body
.substringAfterLast("\"players\":") .substringAfterLast("\"players\":")
.substringBefore(",\"noplayer\":") .substringBefore(",\"noplayer\":")

View File

@ -15,7 +15,7 @@ class MyStreamExtractor(private val client: OkHttpClient, private val headers: H
return runCatching { return runCatching {
val response = client.newCall(GET(url, headers)).execute() val response = client.newCall(GET(url, headers)).execute()
val body = response.use { it.body.string() } val body = response.body.string()
val streamCode = body val streamCode = body
.substringAfter("sniff(") // Video function .substringAfter("sniff(") // Video function

View File

@ -129,7 +129,7 @@ class GoogleDriveIndex : ConfigurableAnimeSource, AnimeHttpSource() {
return if (urlFilter.state.isEmpty()) { return if (urlFilter.state.isEmpty()) {
val req = searchAnimeRequest(page, query, filters) val req = searchAnimeRequest(page, query, filters)
client.newCall(req).awaitSuccess() client.newCall(req).awaitSuccess()
.use { response -> .let { response ->
searchAnimeParse(response, req.url.toString()) searchAnimeParse(response, req.url.toString())
} }
} else { } else {

View File

@ -80,7 +80,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
} }
override fun popularAnimeParse(response: Response): AnimesPage { override fun popularAnimeParse(response: Response): AnimesPage {
val parsed = json.decodeFromString<AnimeResult>(response.use { it.body.string() }) val parsed = json.decodeFromString<AnimeResult>(response.body.string())
val animeList = parsed.data.mapNotNull { it.toSAnimeOrNull() } val animeList = parsed.data.mapNotNull { it.toSAnimeOrNull() }
val position = response.request.url.queryParameter("start")?.toIntOrNull() ?: 0 val position = response.request.url.queryParameter("start")?.toIntOrNull() ?: 0
return AnimesPage(animeList, position + 36 < parsed.total) return AnimesPage(animeList, position + 36 < parsed.total)
@ -110,7 +110,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
} }
override fun searchAnimeParse(response: Response): AnimesPage { override fun searchAnimeParse(response: Response): AnimesPage {
val bod = response.use { it.body.string() } val bod = response.body.string()
val total: Int val total: Int
val items = val items =
if (response.request.url.encodedPath.contains("search")) { if (response.request.url.encodedPath.contains("search")) {
@ -162,7 +162,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
val response = noTokenClient.newCall( val response = noTokenClient.newCall(
POST("https://graphql.anilist.co", body = requestBody), POST("https://graphql.anilist.co", body = requestBody),
).execute().use { it.body.string() } ).execute().body.string()
val responseParsed = json.decodeFromString<AnilistResult>(response) val responseParsed = json.decodeFromString<AnilistResult>(response)
@ -183,7 +183,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
} else { } else {
GET("$crApiUrl/cms/movie_listings/${mediaId.id}?locale=en-US") GET("$crApiUrl/cms/movie_listings/${mediaId.id}?locale=en-US")
}, },
).execute().use { it.body.string() } ).execute().body.string()
val info = json.decodeFromString<AnimeResult>(resp) val info = json.decodeFromString<AnimeResult>(resp)
return info.data.first().toSAnimeOrNull(anime) ?: anime return info.data.first().toSAnimeOrNull(anime) ?: anime
} }
@ -202,7 +202,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
} }
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val seasons = json.decodeFromString<SeasonResult>(response.use { it.body.string() }) val seasons = json.decodeFromString<SeasonResult>(response.body.string())
val series = response.request.url.encodedPath.contains("series/") val series = response.request.url.encodedPath.contains("series/")
val chunkSize = Runtime.getRuntime().availableProcessors() val chunkSize = Runtime.getRuntime().availableProcessors()
return if (series) { return if (series) {
@ -224,7 +224,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
private fun getEpisodes(seasonData: SeasonResult.Season): List<SEpisode> { private fun getEpisodes(seasonData: SeasonResult.Season): List<SEpisode> {
val body = val body =
client.newCall(GET("$crApiUrl/cms/seasons/${seasonData.id}/episodes")) client.newCall(GET("$crApiUrl/cms/seasons/${seasonData.id}/episodes"))
.execute().use { it.body.string() } .execute().body.string()
val episodes = json.decodeFromString<EpisodeResult>(body) val episodes = json.decodeFromString<EpisodeResult>(body)
return episodes.data.sortedBy { it.episode_number }.mapNotNull EpisodeMap@{ ep -> return episodes.data.sortedBy { it.episode_number }.mapNotNull EpisodeMap@{ ep ->
@ -278,7 +278,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
private fun extractVideo(media: Pair<String, String>): List<Video> { private fun extractVideo(media: Pair<String, String>): List<Video> {
val (mediaId, aud) = media val (mediaId, aud) = media
val response = client.newCall(getVideoRequest(mediaId)).execute().use { it.body.string() } val response = client.newCall(getVideoRequest(mediaId)).execute().body.string()
val streams = json.decodeFromString<VideoStreams>(response) val streams = json.decodeFromString<VideoStreams>(response)
val subLocale = preferences.getString(PREF_SUB_KEY, PREF_SUB_DEFAULT)!!.getLocale() val subLocale = preferences.getString(PREF_SUB_KEY, PREF_SUB_DEFAULT)!!.getLocale()
@ -308,7 +308,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
runCatching { runCatching {
val playlist = client.newCall(GET(stream.url)).execute() val playlist = client.newCall(GET(stream.url)).execute()
if (playlist.code != 200) return@parallelMapNotNullBlocking null if (playlist.code != 200) return@parallelMapNotNullBlocking null
playlist.use { it.body.string() }.substringAfter("#EXT-X-STREAM-INF:") playlist.body.string().substringAfter("#EXT-X-STREAM-INF:")
.split("#EXT-X-STREAM-INF:").map { .split("#EXT-X-STREAM-INF:").map {
val hardsub = stream.hardsub_locale.let { hs -> val hardsub = stream.hardsub_locale.let { hs ->
if (hs.isNotBlank()) " - HardSub: $hs" else "" if (hs.isNotBlank()) " - HardSub: $hs" else ""

View File

@ -48,7 +48,7 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
GET("$baseUrl/en/today-hot?page=$page", headers) GET("$baseUrl/en/today-hot?page=$page", headers)
override fun popularAnimeParse(response: Response): AnimesPage { override fun popularAnimeParse(response: Response): AnimesPage {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val entries = document.select("div.thumbnail").map { element -> val entries = document.select("div.thumbnail").map { element ->
SAnime.create().apply { SAnime.create().apply {
@ -95,7 +95,7 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
override fun searchAnimeParse(response: Response) = popularAnimeParse(response) override fun searchAnimeParse(response: Response) = popularAnimeParse(response)
override fun animeDetailsParse(response: Response): SAnime { override fun animeDetailsParse(response: Response): SAnime {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val jpTitle = document.select("div.text-secondary span:contains(title) + span").text() val jpTitle = document.select("div.text-secondary span:contains(title) + span").text()
val siteCover = document.selectFirst("video.player")?.attr("abs:data-poster") val siteCover = document.selectFirst("video.player")?.attr("abs:data-poster")
@ -143,7 +143,7 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
} }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val playlists = document.selectFirst("script:containsData(function(p,a,c,k,e,d))") val playlists = document.selectFirst("script:containsData(function(p,a,c,k,e,d))")
?.data() ?.data()

View File

@ -93,7 +93,7 @@ class SupJav(override val lang: String = "en") : ConfigurableAnimeSource, Parsed
} }
private fun searchAnimeByIdParse(response: Response): AnimesPage { private fun searchAnimeByIdParse(response: Response): AnimesPage {
val details = animeDetailsParse(response.use { it.asJsoup() }) val details = animeDetailsParse(response.asJsoup())
return AnimesPage(listOf(details), false) return AnimesPage(listOf(details), false)
} }
@ -143,7 +143,7 @@ class SupJav(override val lang: String = "en") : ConfigurableAnimeSource, Parsed
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val players = doc.select("div.btnst > a").toList() val players = doc.select("div.btnst > a").toList()
.filter { it.text() in SUPPORTED_PLAYERS } .filter { it.text() in SUPPORTED_PLAYERS }
@ -176,7 +176,7 @@ class SupJav(override val lang: String = "en") : ConfigurableAnimeSource, Parsed
"VOE" -> voeExtractor.videosFromUrl(url) "VOE" -> voeExtractor.videosFromUrl(url)
"FST" -> streamwishExtractor.videosFromUrl(url) "FST" -> streamwishExtractor.videosFromUrl(url)
"TV" -> { "TV" -> {
val body = client.newCall(GET(url)).execute().use { it.body.string() } val body = client.newCall(GET(url)).execute().body.string()
val playlistUrl = body.substringAfter("var urlPlay = '", "") val playlistUrl = body.substringAfter("var urlPlay = '", "")
.substringBefore("';") .substringBefore("';")
.takeUnless(String::isEmpty) .takeUnless(String::isEmpty)

View File

@ -146,7 +146,7 @@ class Anime4Up : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
) )
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val base64 = response.use { it.asJsoup() }.selectFirst("input[name=wl]") val base64 = response.asJsoup().selectFirst("input[name=wl]")
?.attr("value") ?.attr("value")
?.let { String(Base64.decode(it, Base64.DEFAULT)) } ?.let { String(Base64.decode(it, Base64.DEFAULT)) }
?: return emptyList() ?: return emptyList()

View File

@ -14,7 +14,7 @@ class VidYardExtractor(private val client: OkHttpClient, private val headers: He
val id = url.substringAfter("com/").substringBefore("?") val id = url.substringAfter("com/").substringBefore("?")
val playerUrl = "$VIDYARD_URL/player/$id.json" val playerUrl = "$VIDYARD_URL/player/$id.json"
val callPlayer = client.newCall(GET(playerUrl, newHeaders)).execute() val callPlayer = client.newCall(GET(playerUrl, newHeaders)).execute()
.use { it.body.string() } .body.string()
val data = callPlayer.substringAfter("hls\":[").substringBefore("]") val data = callPlayer.substringAfter("hls\":[").substringBefore("]")
val sources = data.split("profile\":\"").drop(1) val sources = data.split("profile\":\"").drop(1)

View File

@ -138,7 +138,7 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
return document.select("span.server a").flatMap { return document.select("span.server a").flatMap {
runCatching { extractVideos(it) }.getOrElse { emptyList() } runCatching { extractVideos(it) }.getOrElse { emptyList() }
} }
@ -152,7 +152,7 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return when { return when {
".vid4up" in url || "Blkom" in element.text() -> { ".vid4up" in url || "Blkom" in element.text() -> {
val videoDoc = client.newCall(GET(url, headers)).execute() val videoDoc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
videoDoc.select(videoListSelector()).map(::videoFromElement) videoDoc.select(videoListSelector()).map(::videoFromElement)
} }
"ok.ru" in url -> okruExtractor.videosFromUrl(url) "ok.ru" in url -> okruExtractor.videosFromUrl(url)

View File

@ -73,9 +73,7 @@ class AnimeLek : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun episodeListParse(response: Response) = super.episodeListParse(response).reversed() override fun episodeListParse(response: Response) = super.episodeListParse(response).reversed()
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response) = videosFromElement(response.asJsoup())
return response.use { videosFromElement(it.asJsoup()) }
}
override fun videoListSelector() = "ul#episode-servers li.watch a" override fun videoListSelector() = "ul#episode-servers li.watch a"

View File

@ -116,7 +116,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun episodeListSelector() = "ul.chapters-list li a:has(h3)" override fun episodeListSelector() = "ul.chapters-list li a:has(h3)"
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
if (document.location().contains("/movies/")) { if (document.location().contains("/movies/")) {
return listOf( return listOf(
SEpisode.create().apply { SEpisode.create().apply {
@ -129,7 +129,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return document.select(episodeListSelector()).flatMap { el -> return document.select(episodeListSelector()).flatMap { el ->
val doc = client.newCall(GET(el.attr("abs:href"), headers)).execute() val doc = client.newCall(GET(el.attr("abs:href"), headers)).execute()
.use { it.asJsoup() } .asJsoup()
val seasonName = doc.selectFirst("div.media-title h1")!!.text() val seasonName = doc.selectFirst("div.media-title h1")!!.text()
val seasonNum = seasonName.substringAfterLast(" ").toIntOrNull() ?: 1 val seasonNum = seasonName.substringAfterLast(" ").toIntOrNull() ?: 1
doc.select(episodeListSelector()).map { doc.select(episodeListSelector()).map {
@ -151,7 +151,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val players = document.select(videoListSelector()) val players = document.select(videoListSelector())
return players.parallelCatchingFlatMapBlocking(::getPlayerVideos) return players.parallelCatchingFlatMapBlocking(::getPlayerVideos)
} }
@ -200,7 +200,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body)) return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute() .execute()
.use { response -> .let { response ->
response.body.string() response.body.string()
.substringAfter("\"embed_url\":\"") .substringAfter("\"embed_url\":\"")
.substringBefore("\",") .substringBefore("\",")

View File

@ -67,7 +67,7 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
override fun latestUpdatesRequest(page: Int) = GET(baseUrl) override fun latestUpdatesRequest(page: Int) = GET(baseUrl)
override fun latestUpdatesParse(response: Response): AnimesPage { override fun latestUpdatesParse(response: Response): AnimesPage {
val latestEpisodes = response.use { it.asJsoup() }.select("div.as-episode") val latestEpisodes = response.asJsoup().select("div.as-episode")
val animeList = latestEpisodes.map { val animeList = latestEpisodes.map {
SAnime.create().apply { SAnime.create().apply {
val ahref = it.selectFirst("a.as-info")!! val ahref = it.selectFirst("a.as-info")!!
@ -98,7 +98,7 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
return if (response.body.contentType() == "application/json".toMediaType()) { return if (response.body.contentType() == "application/json".toMediaType()) {
popularAnimeParse(response) popularAnimeParse(response)
} else { } else {
val searchResult = response.use { it.asJsoup() }.select("div.show") val searchResult = response.asJsoup().select("div.show")
val animeList = searchResult.map { val animeList = searchResult.map {
SAnime.create().apply { SAnime.create().apply {
setUrlWithoutDomain(it.selectFirst("a")!!.attr("href")) setUrlWithoutDomain(it.selectFirst("a")!!.attr("href"))
@ -138,7 +138,7 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
// =========================== Anime Details ============================ // =========================== Anime Details ============================
override fun animeDetailsParse(response: Response): SAnime { override fun animeDetailsParse(response: Response): SAnime {
val showData = response.use { it.asJsoup() }.selectFirst("div#data")!! val showData = response.asJsoup().selectFirst("div#data")!!
.text() .text()
.decodeBase64() .decodeBase64()
@ -159,7 +159,7 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
// ============================== Episodes ============================== // ============================== Episodes ==============================
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val showData = response.use { it.asJsoup() }.selectFirst("div#data") val showData = response.asJsoup().selectFirst("div#data")
?.text() ?.text()
?.decodeBase64() ?.decodeBase64()
?: return emptyList() ?: return emptyList()
@ -176,7 +176,7 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val watchData = response.use { it.asJsoup() }.selectFirst("div#datawatch") val watchData = response.asJsoup().selectFirst("div#datawatch")
?.text() ?.text()
?.decodeBase64() ?.decodeBase64()
?: return emptyList() ?: return emptyList()
@ -184,13 +184,13 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
val serversJson = json.decodeFromString<Episode>(watchData) val serversJson = json.decodeFromString<Episode>(watchData)
val selectServer = serversJson.ep_info[0].stream_servers[0].decodeBase64() val selectServer = serversJson.ep_info[0].stream_servers[0].decodeBase64()
val watchPage = client.newCall(GET(selectServer)).execute().use { it.asJsoup() } val watchPage = client.newCall(GET(selectServer)).execute().asJsoup()
return watchPage.select("option") return watchPage.select("option")
.map { it.text() to it.attr("data-src").decodeBase64() } // server : url .map { it.text() to it.attr("data-src").decodeBase64() } // server : url
.filter { it.second.contains("$baseUrl/embed") } // filter urls .filter { it.second.contains("$baseUrl/embed") } // filter urls
.flatMap { (name, url) -> .flatMap { (name, url) ->
client.newCall(GET(url)).execute() client.newCall(GET(url)).execute()
.use { it.asJsoup() } .asJsoup()
.select("source") .select("source")
.mapNotNull { source -> .mapNotNull { source ->
val videoUrl = source.attr("src") val videoUrl = source.attr("src")

View File

@ -107,7 +107,7 @@ class ArabSeed : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return when { return when {
"reviewtech" in url || "reviewrate" in url -> { "reviewtech" in url || "reviewrate" in url -> {
val iframeResponse = client.newCall(GET(url)).execute() val iframeResponse = client.newCall(GET(url)).execute()
.use { it.asJsoup() } .asJsoup()
val videoUrl = iframeResponse.selectFirst("source")!!.attr("abs:src") val videoUrl = iframeResponse.selectFirst("source")!!.attr("abs:src")
listOf(Video(videoUrl, quality + "p", videoUrl)) listOf(Video(videoUrl, quality + "p", videoUrl))
} }

View File

@ -77,13 +77,13 @@ class Asia2TV : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun videoListRequest(episode: SEpisode): Request { override fun videoListRequest(episode: SEpisode): Request {
val document = client.newCall(GET(baseUrl + episode.url)).execute() val document = client.newCall(GET(baseUrl + episode.url)).execute()
.use { it.asJsoup() } .asJsoup()
val link = document.selectFirst("div.loop-episode a.current")!!.attr("href") val link = document.selectFirst("div.loop-episode a.current")!!.attr("href")
return GET(link) return GET(link)
} }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
return document.select(videoListSelector()).parallelCatchingFlatMapBlocking { return document.select(videoListSelector()).parallelCatchingFlatMapBlocking {
val url = it.attr("data-server") val url = it.attr("data-server")
getVideosFromUrl(url) getVideosFromUrl(url)
@ -106,7 +106,7 @@ class Asia2TV : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
"uqload" in url -> uqloadExtractor.videosFromUrl(url) "uqload" in url -> uqloadExtractor.videosFromUrl(url)
VID_BOM_DOMAINS.any(url::contains) -> vidbomExtractor.videosFromUrl(url) VID_BOM_DOMAINS.any(url::contains) -> vidbomExtractor.videosFromUrl(url)
"youdbox" in url || "yodbox" in url -> { "youdbox" in url || "yodbox" in url -> {
client.newCall(GET(url)).execute().use { client.newCall(GET(url)).execute().let {
val doc = it.asJsoup() val doc = it.asJsoup()
val videoUrl = doc.selectFirst("source")?.attr("abs:src") val videoUrl = doc.selectFirst("source")?.attr("abs:src")
when (videoUrl) { when (videoUrl) {

View File

@ -132,7 +132,7 @@ class EgyDead : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val document = client.newCall(POST(baseUrl + episode.url, body = requestBody)) val document = client.newCall(POST(baseUrl + episode.url, body = requestBody))
.await() .await()
.use { it.asJsoup() } .asJsoup()
return document.select(videoListSelector()).parallelCatchingFlatMap { return document.select(videoListSelector()).parallelCatchingFlatMap {
val url = it.attr("data-link") val url = it.attr("data-link")
extractVideos(url) extractVideos(url)

View File

@ -135,7 +135,7 @@ class Okanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!! val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!!
return response.use { it.asJsoup() } return response.asJsoup()
.select("a.ep-link") .select("a.ep-link")
.parallelCatchingFlatMapBlocking { element -> .parallelCatchingFlatMapBlocking { element ->
val quality = element.selectFirst("span")?.text().orEmpty().let { val quality = element.selectFirst("span")?.text().orEmpty().let {

View File

@ -186,7 +186,7 @@ class WitAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
else -> headers else -> headers
} }
val doc = client.newCall(GET(url, newHeaders)).execute() val doc = client.newCall(GET(url, newHeaders)).execute()
.use { it.asJsoup() } .asJsoup()
return doc.select(".OD li").flatMap { element -> return doc.select(".OD li").flatMap { element ->
val videoUrl = element.attr("onclick").substringAfter("go_to_player('") val videoUrl = element.attr("onclick").substringAfter("go_to_player('")
.substringBefore("')") .substringBefore("')")

View File

@ -54,7 +54,7 @@ class Aniking : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun episodeListSelector() = throw UnsupportedOperationException() override fun episodeListSelector() = throw UnsupportedOperationException()
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
return if (document.selectFirst("#movie-js-extra") == null) { return if (document.selectFirst("#movie-js-extra") == null) {
val episodeElement = document.selectFirst("script[id=\"tv-js-after\"]")!! val episodeElement = document.selectFirst("script[id=\"tv-js-after\"]")!!
episodeElement.data() episodeElement.data()

View File

@ -67,7 +67,7 @@ class AnimeBase : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private val searchToken by lazy { private val searchToken by lazy {
client.newCall(GET("$baseUrl/searching", headers)).execute() client.newCall(GET("$baseUrl/searching", headers)).execute()
.use { it.asJsoup() } .asJsoup()
.selectFirst("form > input[name=_token]")!! .selectFirst("form > input[name=_token]")!!
.attr("value") .attr("value")
} }
@ -96,7 +96,7 @@ class AnimeBase : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
} }
override fun searchAnimeParse(response: Response): AnimesPage { override fun searchAnimeParse(response: Response): AnimesPage {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
return when { return when {
doc.location().contains("/searching") -> { doc.location().contains("/searching") -> {
@ -186,7 +186,7 @@ class AnimeBase : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
} }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val selector = response.request.url.queryParameter("selector") val selector = response.request.url.queryParameter("selector")
?: return emptyList() ?: return emptyList()

View File

@ -13,7 +13,7 @@ class UnpackerExtractor(private val client: OkHttpClient, private val headers: H
fun videosFromUrl(url: String, hoster: String): List<Video> { fun videosFromUrl(url: String, hoster: String): List<Video> {
val doc = client.newCall(GET(url, headers)).execute() val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
val script = doc.selectFirst("script:containsData(eval)") val script = doc.selectFirst("script:containsData(eval)")
?.data() ?.data()

View File

@ -33,14 +33,14 @@ class VidGuardExtractor(private val client: OkHttpClient) {
} }
fun videosFromUrl(url: String): List<Video> { fun videosFromUrl(url: String): List<Video> {
val doc = client.newCall(GET(url)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url)).execute().asJsoup()
val scriptUrl = doc.selectFirst("script[src*=ad/plugin]") val scriptUrl = doc.selectFirst("script[src*=ad/plugin]")
?.absUrl("src") ?.absUrl("src")
?: return emptyList() ?: return emptyList()
val headers = Headers.headersOf("Referer", url) val headers = Headers.headersOf("Referer", url)
val script = client.newCall(GET(scriptUrl, headers)).execute() val script = client.newCall(GET(scriptUrl, headers)).execute()
.use { it.body.string() } .body.string()
val sources = getSourcesFromScript(script, url) val sources = getSourcesFromScript(script, url)
.takeIf { it.isNotBlank() && it != "undefined" } .takeIf { it.isNotBlank() && it != "undefined" }

View File

@ -87,7 +87,7 @@ class Einfach : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
} }
private fun searchAnimeByPathParse(response: Response): AnimesPage { private fun searchAnimeByPathParse(response: Response): AnimesPage {
val details = animeDetailsParse(response.use { it.asJsoup() }) val details = animeDetailsParse(response.asJsoup())
return AnimesPage(listOf(details), false) return AnimesPage(listOf(details), false)
} }
@ -154,7 +154,7 @@ class Einfach : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() } val doc = response.asJsoup()
val selection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!! val selection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!!

View File

@ -16,7 +16,7 @@ class MyStreamExtractor(private val client: OkHttpClient, private val headers: H
return runCatching { return runCatching {
val response = client.newCall(GET(url, headers)).execute() val response = client.newCall(GET(url, headers)).execute()
val body = response.use { it.body.string() } val body = response.body.string()
val codePart = body val codePart = body
.substringAfter("sniff(") // Video function .substringAfter("sniff(") // Video function

View File

@ -13,7 +13,7 @@ class UnpackerExtractor(private val client: OkHttpClient, private val headers: H
fun videosFromUrl(url: String, hoster: String): List<Video> { fun videosFromUrl(url: String, hoster: String): List<Video> {
val doc = client.newCall(GET(url, headers)).execute() val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
val script = doc.selectFirst("script:containsData(eval)") val script = doc.selectFirst("script:containsData(eval)")
?.data() ?.data()

View File

@ -9,7 +9,7 @@ class VidozaExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String): List<Video> { fun videosFromUrl(url: String): List<Video> {
val doc = client.newCall(GET(url)).execute() val doc = client.newCall(GET(url)).execute()
.use { it.asJsoup() } .asJsoup()
val script = doc.selectFirst("script:containsData(sourcesCode: [)") val script = doc.selectFirst("script:containsData(sourcesCode: [)")
?.data() ?.data()

View File

@ -140,7 +140,7 @@ class FilmPalast : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
"wolfstream" in url && hosterSelection.contains("wolf") -> { "wolfstream" in url && hosterSelection.contains("wolf") -> {
client.newCall(GET(url, headers)).execute() client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
.selectFirst("script:containsData(sources)") .selectFirst("script:containsData(sources)")
?.data() ?.data()
?.let { jsData -> ?.let { jsData ->

View File

@ -13,7 +13,7 @@ class UnpackerExtractor(private val client: OkHttpClient, private val headers: H
fun videosFromUrl(url: String, hoster: String): List<Video> { fun videosFromUrl(url: String, hoster: String): List<Video> {
val doc = client.newCall(GET(url, headers)).execute() val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() } .asJsoup()
val script = doc.selectFirst("script:containsData(eval)") val script = doc.selectFirst("script:containsData(eval)")
?.data() ?.data()

View File

@ -33,14 +33,14 @@ class VidGuardExtractor(private val client: OkHttpClient) {
} }
fun videosFromUrl(url: String): List<Video> { fun videosFromUrl(url: String): List<Video> {
val doc = client.newCall(GET(url)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url)).execute().asJsoup()
val scriptUrl = doc.selectFirst("script[src*=ad/plugin]") val scriptUrl = doc.selectFirst("script[src*=ad/plugin]")
?.absUrl("src") ?.absUrl("src")
?: return emptyList() ?: return emptyList()
val headers = Headers.headersOf("Referer", url) val headers = Headers.headersOf("Referer", url)
val script = client.newCall(GET(scriptUrl, headers)).execute() val script = client.newCall(GET(scriptUrl, headers)).execute()
.use { it.body.string() } .body.string()
val sources = getSourcesFromScript(script, url) val sources = getSourcesFromScript(script, url)
.takeIf { it.isNotBlank() && it != "undefined" } .takeIf { it.isNotBlank() && it != "undefined" }

View File

@ -85,7 +85,7 @@ class StreamCloud : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================== Episodes ============================== // ============================== Episodes ==============================
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val episode = SEpisode.create().apply { val episode = SEpisode.create().apply {
name = document.selectFirst("#title span.title")!!.text() name = document.selectFirst("#title span.title")!!.text()
episode_number = 1F episode_number = 1F
@ -104,11 +104,11 @@ class StreamCloud : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private val mixdropExtractor by lazy { MixDropExtractor(client) } private val mixdropExtractor by lazy { MixDropExtractor(client) }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val iframeurl = document.selectFirst("div.player-container-wrap > iframe") val iframeurl = document.selectFirst("div.player-container-wrap > iframe")
?.attr("src") ?.attr("src")
?: error("No videos!") ?: error("No videos!")
val iframeDoc = client.newCall(GET(iframeurl)).execute().use { it.asJsoup() } val iframeDoc = client.newCall(GET(iframeurl)).execute().asJsoup()
val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!! val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!!
val items = iframeDoc.select("div._player ul._player-mirrors li") val items = iframeDoc.select("div._player ul._player-mirrors li")

View File

@ -161,7 +161,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override suspend fun getEpisodeList(anime: SAnime): List<SEpisode> { override suspend fun getEpisodeList(anime: SAnime): List<SEpisode> {
val document = client.newCall(GET(baseUrl + anime.url)).execute() val document = client.newCall(GET(baseUrl + anime.url)).execute()
.use { it.asJsoup() } .asJsoup()
val seasonList = document.select("div.inline > h3:contains(Season),div.thecontent > h3:contains(Season)") val seasonList = document.select("div.inline > h3:contains(Season),div.thecontent > h3:contains(Season)")
@ -177,7 +177,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val url = it.selectFirst("a")!!.attr("href") val url = it.selectFirst("a")!!.attr("href")
val episodesDocument = client.newCall(GET(url)).execute() val episodesDocument = client.newCall(GET(url)).execute()
.use { it.asJsoup() } .asJsoup()
episodesDocument.select("div.entry-content > h3 > a").map { episodesDocument.select("div.entry-content > h3 > a").map {
EpUrl(quality, it.attr("href"), "Season $seasonNumber ${it.text()}") EpUrl(quality, it.attr("href"), "Season $seasonNumber ${it.text()}")
} }
@ -194,7 +194,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// Load episodes // Load episodes
val serversList = driveList.map { drive -> val serversList = driveList.map { drive ->
val episodesDocument = client.newCall(GET(drive.first)).execute() val episodesDocument = client.newCall(GET(drive.first)).execute()
.use { it.asJsoup() } .asJsoup()
episodesDocument.select("div.entry-content > h3 > a").map { episodesDocument.select("div.entry-content > h3 > a").map {
EpUrl(drive.second, it.attr("href"), it.text()) EpUrl(drive.second, it.attr("href"), it.text())
} }
@ -225,14 +225,14 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val leechUrls = urls.map { val leechUrls = urls.map {
val firstLeech = client.newCall(GET(it.url)).execute() val firstLeech = client.newCall(GET(it.url)).execute()
.use { it.asJsoup() } .asJsoup()
.selectFirst("script:containsData(downlaod_button)")!! .selectFirst("script:containsData(downlaod_button)")!!
.data() .data()
.substringAfter("<a href=\"") .substringAfter("<a href=\"")
.substringBefore("\">") .substringBefore("\">")
val path = client.newCall(GET(firstLeech)).execute() val path = client.newCall(GET(firstLeech)).execute()
.use { it.body.string() } .body.string()
.substringAfter("replace(\"") .substringAfter("replace(\"")
.substringBefore("\"") .substringBefore("\"")
@ -277,7 +277,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private fun extractWorkerLinks(mediaUrl: String, quality: String, type: Int): List<Video> { private fun extractWorkerLinks(mediaUrl: String, quality: String, type: Int): List<Video> {
val reqLink = mediaUrl.replace("/file/", "/wfile/") + "?type=$type" val reqLink = mediaUrl.replace("/file/", "/wfile/") + "?type=$type"
val resp = client.newCall(GET(reqLink)).execute().use { it.asJsoup() } val resp = client.newCall(GET(reqLink)).execute().asJsoup()
val sizeMatch = SIZE_REGEX.find(resp.select("div.card-header").text().trim()) val sizeMatch = SIZE_REGEX.find(resp.select("div.card-header").text().trim())
val size = sizeMatch?.groups?.get(1)?.value?.let { " - $it" } ?: "" val size = sizeMatch?.groups?.get(1)?.value?.let { " - $it" } ?: ""
return resp.select("div.card-body div.mb-4 > a").mapIndexed { index, linkElement -> return resp.select("div.card-body div.mb-4 > a").mapIndexed { index, linkElement ->
@ -297,7 +297,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
} }
private fun getDirectLink(url: String, action: String = "direct", newPath: String = "/file/"): String? { private fun getDirectLink(url: String, action: String = "direct", newPath: String = "/file/"): String? {
val doc = client.newCall(GET(url, headers)).execute().use { it.asJsoup() } val doc = client.newCall(GET(url, headers)).execute().asJsoup()
val script = doc.selectFirst("script:containsData(async function taskaction)") val script = doc.selectFirst("script:containsData(async function taskaction)")
?.data() ?.data()
?: return url ?: return url
@ -314,18 +314,18 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val req = client.newCall(POST(url.replace("/file/", newPath), headers, form)).execute() val req = client.newCall(POST(url.replace("/file/", newPath), headers, form)).execute()
return runCatching { return runCatching {
json.decodeFromString<DriveLeechDirect>(req.use { it.body.string() }).url json.decodeFromString<DriveLeechDirect>(req.body.string()).url
}.getOrNull() }.getOrNull()
} }
private fun extractGDriveLink(mediaUrl: String, quality: String): List<Video> { private fun extractGDriveLink(mediaUrl: String, quality: String): List<Video> {
val neoUrl = getDirectLink(mediaUrl) ?: mediaUrl val neoUrl = getDirectLink(mediaUrl) ?: mediaUrl
val response = client.newCall(GET(neoUrl)).execute().use { it.asJsoup() } val response = client.newCall(GET(neoUrl)).execute().asJsoup()
val gdBtn = response.selectFirst("div.card-body a.btn")!! val gdBtn = response.selectFirst("div.card-body a.btn")!!
val gdLink = gdBtn.attr("href") val gdLink = gdBtn.attr("href")
val sizeMatch = SIZE_REGEX.find(gdBtn.text()) val sizeMatch = SIZE_REGEX.find(gdBtn.text())
val size = sizeMatch?.groups?.get(1)?.value?.let { " - $it" } ?: "" val size = sizeMatch?.groups?.get(1)?.value?.let { " - $it" } ?: ""
val gdResponse = client.newCall(GET(gdLink)).execute().use { it.asJsoup() } val gdResponse = client.newCall(GET(gdLink)).execute().asJsoup()
val link = gdResponse.select("form#download-form") val link = gdResponse.select("form#download-form")
return if (link.isNullOrEmpty()) { return if (link.isNullOrEmpty()) {
emptyList() emptyList()

View File

@ -74,7 +74,7 @@ class AnimePahe : ConfigurableAnimeSource, AnimeHttpSource() {
} }
override fun animeDetailsParse(response: Response): SAnime { override fun animeDetailsParse(response: Response): SAnime {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
return SAnime.create().apply { return SAnime.create().apply {
title = document.selectFirst("div.title-wrapper > h1 > span")!!.text() title = document.selectFirst("div.title-wrapper > h1 > span")!!.text()
author = document.selectFirst("div.col-sm-4.anime-info p:contains(Studio:)") author = document.selectFirst("div.col-sm-4.anime-info p:contains(Studio:)")
@ -187,7 +187,7 @@ class AnimePahe : ConfigurableAnimeSource, AnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val downloadLinks = document.select("div#pickDownload > a") val downloadLinks = document.select("div#pickDownload > a")
return document.select("div#resolutionMenu > button").mapIndexed { index, btn -> return document.select("div#resolutionMenu > button").mapIndexed { index, btn ->
val kwikLink = btn.attr("data-src") val kwikLink = btn.attr("data-src")
@ -307,7 +307,7 @@ class AnimePahe : ConfigurableAnimeSource, AnimeHttpSource() {
private fun fetchSession(title: String, animeId: String): String { private fun fetchSession(title: String, animeId: String): String {
return client.newCall(GET("$baseUrl/api?m=search&q=$title")) return client.newCall(GET("$baseUrl/api?m=search&q=$title"))
.execute() .execute()
.use { it.body.string() } .body.string()
.substringAfter("\"id\":$animeId") .substringAfter("\"id\":$animeId")
.substringAfter("\"session\":\"") .substringAfter("\"session\":\"")
.substringBefore("\"") .substringBefore("\"")

View File

@ -118,7 +118,7 @@ class AnimeParadise : ConfigurableAnimeSource, AnimeHttpSource() {
} }
override fun animeDetailsParse(response: Response): SAnime { override fun animeDetailsParse(response: Response): SAnime {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return SAnime.create() val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return SAnime.create()
return json.decodeFromString<AnimeDetails>(data).props.pageProps.data.toSAnime() return json.decodeFromString<AnimeDetails>(data).props.pageProps.data.toSAnime()
@ -141,7 +141,7 @@ class AnimeParadise : ConfigurableAnimeSource, AnimeHttpSource() {
override fun videoListRequest(episode: SEpisode): Request = GET(baseUrl + episode.url, headers = docHeaders) override fun videoListRequest(episode: SEpisode): Request = GET(baseUrl + episode.url, headers = docHeaders)
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val data = json.decodeFromString<VideoData>( val data = json.decodeFromString<VideoData>(
document.selectFirst("script#__NEXT_DATA__")!!.data(), document.selectFirst("script#__NEXT_DATA__")!!.data(),
).props.pageProps ).props.pageProps

View File

@ -104,7 +104,7 @@ class AnimeUI : ConfigurableAnimeSource, AnimeHttpSource() {
override fun animeDetailsRequest(anime: SAnime) = GET(baseUrl + anime.url, docHeaders) override fun animeDetailsRequest(anime: SAnime) = GET(baseUrl + anime.url, docHeaders)
override fun animeDetailsParse(response: Response): SAnime { override fun animeDetailsParse(response: Response): SAnime {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return SAnime.create() val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return SAnime.create()
return json.decodeFromString<AnimeData>(data).props.pageProps.animeData.toSAnime() return json.decodeFromString<AnimeData>(data).props.pageProps.animeData.toSAnime()
@ -115,7 +115,7 @@ class AnimeUI : ConfigurableAnimeSource, AnimeHttpSource() {
override fun episodeListRequest(anime: SAnime): Request = animeDetailsRequest(anime) override fun episodeListRequest(anime: SAnime): Request = animeDetailsRequest(anime)
override fun episodeListParse(response: Response): List<SEpisode> { override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return emptyList() val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return emptyList()
return json.decodeFromString<AnimeData>(data).props.pageProps.animeData.episodes.map { return json.decodeFromString<AnimeData>(data).props.pageProps.animeData.episodes.map {
@ -128,7 +128,7 @@ class AnimeUI : ConfigurableAnimeSource, AnimeHttpSource() {
override fun videoListRequest(episode: SEpisode): Request = GET(baseUrl + episode.url, headers = docHeaders) override fun videoListRequest(episode: SEpisode): Request = GET(baseUrl + episode.url, headers = docHeaders)
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return emptyList() val data = document.selectFirst("script#__NEXT_DATA__")?.data() ?: return emptyList()
val parsed = json.decodeFromString<EpisodeData>(data).props.pageProps.episodeData val parsed = json.decodeFromString<EpisodeData>(data).props.pageProps.episodeData

View File

@ -177,7 +177,7 @@ class AsiaFlix : AnimeHttpSource(), ConfigurableAnimeSource {
private val mixDropExtractor by lazy { MixDropExtractor(client) } private val mixDropExtractor by lazy { MixDropExtractor(client) }
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val hostUrls = document.select("ul.list-server-items li").map { val hostUrls = document.select("ul.list-server-items li").map {
it.attr("data-video") it.attr("data-video")

View File

@ -108,13 +108,13 @@ class AsianLoad : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override fun videoListRequest(episode: SEpisode): Request { override fun videoListRequest(episode: SEpisode): Request {
val document = client.newCall(GET(baseUrl + episode.url)).execute() val document = client.newCall(GET(baseUrl + episode.url)).execute()
.use { it.asJsoup() } .asJsoup()
val iframe = document.selectFirst("iframe")!!.attr("abs:src") val iframe = document.selectFirst("iframe")!!.attr("abs:src")
return GET(iframe) return GET(iframe)
} }
override fun videoListParse(response: Response): List<Video> = override fun videoListParse(response: Response): List<Video> =
response.use { it.asJsoup() } // document response.asJsoup() // document
.select(videoListSelector()) // players .select(videoListSelector()) // players
.flatMap(::videosFromElement) // videos .flatMap(::videosFromElement) // videos

View File

@ -78,7 +78,7 @@ class DramaCool : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// =========================== Anime Details ============================ // =========================== Anime Details ============================
override fun animeDetailsRequest(anime: SAnime): Request { override fun animeDetailsRequest(anime: SAnime): Request {
if (anime.url.contains("-episode-") && anime.url.endsWith(".html")) { if (anime.url.contains("-episode-") && anime.url.endsWith(".html")) {
val doc = client.newCall(GET(baseUrl + anime.url)).execute().use { it.asJsoup() } val doc = client.newCall(GET(baseUrl + anime.url)).execute().asJsoup()
anime.setUrlWithoutDomain(doc.selectFirst("div.category a")!!.attr("href")) anime.setUrlWithoutDomain(doc.selectFirst("div.category a")!!.attr("href"))
} }
return GET(baseUrl + anime.url) return GET(baseUrl + anime.url)
@ -119,9 +119,9 @@ class DramaCool : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun videoListSelector() = "ul.list-server-items li" override fun videoListSelector() = "ul.list-server-items li"
override fun videoListParse(response: Response): List<Video> { override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() } val document = response.asJsoup()
val iframeUrl = document.selectFirst("iframe")?.absUrl("src") ?: return emptyList() val iframeUrl = document.selectFirst("iframe")?.absUrl("src") ?: return emptyList()
val iframeDoc = client.newCall(GET(iframeUrl)).execute().use { it.asJsoup() } val iframeDoc = client.newCall(GET(iframeUrl)).execute().asJsoup()
return iframeDoc.select(videoListSelector()).flatMap(::videosFromElement) return iframeDoc.select(videoListSelector()).flatMap(::videosFromElement)
} }

Some files were not shown because too many files have changed in this diff Show More