[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) {
fun videosFromUrl(url: String, headers: Headers, suffix: String = ""): List<Video> {
return client.newCall(GET(url, headers)).execute()
.use { it.body.string() }
.body.string()
.takeIf { !it.contains("errorContainer") }
.let { it ?: return emptyList() }
.substringAfter("\"streams\":[")

View File

@ -18,7 +18,7 @@ class BurstCloudExtractor(private val client: OkHttpClient) {
val newHeaders = headers.newBuilder().set("referer", BURSTCLOUD_URL).build()
return runCatching {
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 formBody = FormBody.Builder()
@ -27,7 +27,7 @@ class BurstCloudExtractor(private val client: OkHttpClient) {
val jsonHeaders = headers.newBuilder().set("referer", document.location()).build()
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 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")
.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 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) }
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 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> {
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
@ -33,7 +33,7 @@ class FastreamExtractor(private val client: OkHttpClient, private val headers: H
add(it.attr("name"), it.attr("value"))
}
}.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()
} else {
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}")
.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 unpacked = JsUnpacker.unpackAndCombine(jsEval).orEmpty()
val masterUrl = unpacked.takeIf(String::isNotBlank)
@ -42,7 +42,7 @@ class FilemoonExtractor(private val client: OkHttpClient) {
if (subUrl != null) {
runCatching { // to prevent failures on serialization errors
client.newCall(GET(subUrl, videoHeaders)).execute()
.use { it.body.string() }
.body.string()
.let { json.decodeFromString<List<SubtitleDto>>(it) }
.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("Accept-Language", "en-US,en;q=0.5")
.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 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 data = Base64.decode(encoded, Base64.DEFAULT).toString(Charsets.UTF_8)
val jsonData = data.split("|||")[1].replace("\\", "")

View File

@ -27,7 +27,7 @@ class GogoStreamExtractor(private val client: OkHttpClient) {
fun videosFromUrl(serverUrl: String): List<Video> {
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 secretKey = document.selectFirst("body[class]")!!.getBytesAfter("container-")
val decryptionKey = document.selectFirst("div.videocontent")!!.getBytesAfter("videocontent-")
@ -54,7 +54,7 @@ class GogoStreamExtractor(private val client: OkHttpClient) {
"XMLHttpRequest",
),
),
).execute().use { it.body.string() }
).execute().body.string()
val data = json.decodeFromString<EncryptedDataDto>(jsonResponse).data
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)
}
val document = docResp.use { it.asJsoup() }
val document = docResp.asJsoup()
val itemSize = document.selectFirst("span.uc-name-size")
?.let { " ${it.ownText().trim()} " }

View File

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

View File

@ -71,7 +71,7 @@ class MegaCloudExtractor(
}
val script = noCacheClient.newCall(GET(scriptUrl, cache = cacheControl))
.execute()
.use { it.body.string() }
.body.string()
val regex =
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()
@ -147,7 +147,7 @@ class MegaCloudExtractor(
.substringBefore("?", "").ifEmpty { throw Exception("I HATE THE ANTICHRIST") }
val srcRes = client.newCall(GET(SERVER_URL[type] + SOURCES_URL[type] + id))
.execute()
.use { it.body.string() }
.body.string()
val data = json.decodeFromString<SourceResponseDto>(srcRes)

View File

@ -18,7 +18,7 @@ class MixDropExtractor(private val client: OkHttpClient) {
referer: String = DEFAULT_REFERER,
): List<Video> {
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)")
?.data()
?.let(Unpacker::unpack)

View File

@ -13,7 +13,7 @@ class Mp4uploadExtractor(private val client: OkHttpClient) {
.set("referer", REFERER)
.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()
?.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 masterPlaylist = client.newCall(GET(playlistUrl, masterHeaders)).execute()
.use { it.body.string() }
.body.string()
// Check if there isn't multiple streams available
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 doc = client.newCall(GET(mpdUrl, mpdHeaders)).execute()
.use { it.asJsoup() }
.asJsoup()
// Get audio tracks
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) }
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()
return if (masterUrl.contains(".m3u8")) {

View File

@ -7,7 +7,7 @@ import okhttp3.OkHttpClient
class StreamDavExtractor(private val client: OkHttpClient) {
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 {
val videoUrl = it.attr("src")
val quality = it.attr("label")

View File

@ -9,7 +9,7 @@ class StreamHubExtractor(private val client: OkHttpClient) {
private val playlistUtils by lazy { PlaylistUtils(client) }
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 sub = REGEX_SUB.find(document)?.groupValues?.get(1)
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
} 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 script = document.selectFirst("script:containsData($targetLine)")
?.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> {
val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() }
.asJsoup()
// Sometimes the script body is packed, sometimes it isn't
val scriptBody = doc.selectFirst("script:containsData(m3u8)")?.data()
?.let { script ->

View File

@ -8,7 +8,7 @@ import okhttp3.OkHttpClient
class UqloadExtractor(private val client: OkHttpClient) {
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()
?: return emptyList()

View File

@ -14,7 +14,7 @@ class VidoExtractor(private val client: OkHttpClient) {
private val playlistUtils by lazy { PlaylistUtils(client) }
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 masterUrl = "$VIDO_URL/hls/$id/master.m3u8"
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)
.build()
private val keys by lazy {
noCacheClient.newCall(
GET("https://raw.githubusercontent.com/KillerDogeEmpire/vidplay-keys/keys/keys.json", cache = cacheControl),
).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 apiUrl = getApiUrl(embedLink, keys)
@ -64,7 +63,7 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
return playlistUtils.extractFromHls(
data.result.sources.first().file,
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(),
)
}
@ -114,7 +113,7 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
private fun callFromFuToken(host: String, data: String): String {
val fuTokenScript = client.newCall(
GET("https://$host/futoken"),
).execute().use { it.body.string() }
).execute().body.string()
val js = buildString {
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> {
val data = client.newCall(GET(url, documentHeaders)).execute()
.use { it.body.string() }
.body.string()
return REGEX_VIDEO.findAll(data).map {
val quality = it.groupValues[1]

View File

@ -7,7 +7,7 @@ import okhttp3.OkHttpClient
class VoeExtractor(private val client: OkHttpClient) {
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)")
?.data()
?: return null

View File

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

View File

@ -51,7 +51,7 @@ class AnimeBalkan : AnimeStream(
gdriveExtractor.videosFromUrl(newUrl)
}
"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")
?: return emptyList()
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> {
val document = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() }
.asJsoup()
val metaUrl = document.selectFirst("script:containsData(metadataUrl)")
?.data()
@ -35,7 +35,7 @@ class MailRuExtractor(private val client: OkHttpClient, private val headers: Hea
val metaResponse = client.newCall(GET(metaUrl, metaHeaders)).execute()
val metaJson = json.decodeFromString<MetaResponse>(
metaResponse.use { it.body.string() },
metaResponse.body.string(),
)
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> {
val body = client.newCall(GET(url)).execute()
.use { it.body.string() }
.body.string()
val playlistUrl = regexPlaylist.find(body)!!.groupValues.get(1)
val headers = Headers.headersOf("Referer", "https://vidmoly.to")
val playlistData = client.newCall(GET(playlistUrl, headers)).execute()
.use { it.body.string() }
.body.string()
val separator = "#EXT-X-STREAM-INF:"
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=")))
.execute()
.use { it.asJsoup() }
.asJsoup()
val ytcfg = document.selectFirst("script:containsData(window.ytcfg=window.ytcfg)")
?.data() ?: run {
@ -81,7 +81,7 @@ class YouTubeExtractor(private val client: OkHttpClient) {
}.build()
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

View File

@ -28,12 +28,12 @@ class ShittyProtectionInterceptor(private val client: OkHttpClient) : Intercepto
}
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 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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ class LMAnime : AnimeStream(
override val prefQualityEntries = prefQualityValues
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)!!
return items
.filter { element ->

View File

@ -28,12 +28,12 @@ class ShittyProtectionInterceptor(private val client: OkHttpClient) : Intercepto
}
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 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

View File

@ -126,7 +126,7 @@ class TRAnimeCI : AnimeStream(
// ============================ Video Links =============================
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()
return script.substringAfter("[").substringBefore("]")
.split("{")

View File

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

View File

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

View File

@ -21,7 +21,7 @@ class AnimeSAGA : DooPlay(
// ============================ Video Links =============================
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])")
.map(::getPlayerUrl)
@ -51,9 +51,9 @@ class AnimeSAGA : DooPlay(
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute()
.use { response ->
.let { response ->
response
.use { it.body.string() }
.body.string()
.substringAfter("\"embed_url\":\"")
.substringBefore("\",")
.replace("\\", "")

View File

@ -53,8 +53,7 @@ class AnimesFoxBR : DooPlay(
}
private fun extractVideos(url: String, language: String): List<Video> {
return client.newCall(GET(url, headers)).execute()
.use { response ->
return client.newCall(GET(url, headers)).execute().let { response ->
response.body.string()
.substringAfter("sources:[")
.substringBefore("]")
@ -79,7 +78,7 @@ class AnimesFoxBR : DooPlay(
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute()
.use { response ->
.let { response ->
response.body.string()
.substringAfter("\"embed_url\":\"")
.substringBefore("\",")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,8 +15,8 @@ class RedplayBypasser(
) {
fun fromUrl(url: String): String {
val linkUrl = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup().selectFirst("a")!!.attr("href") }
val linkUrl = client.newCall(GET(url, headers)).execute().asJsoup()
.selectFirst("a")!!.attr("href")
val newHeaders = headers.newBuilder().set("Referer", linkUrl).build()
@ -24,11 +24,10 @@ class RedplayBypasser(
return getIframeUrl(response, newHeaders)
}
private fun getIframeUrl(response: Response, newHeaders: Headers): String {
return response.use { page ->
private fun getIframeUrl(page: Response, newHeaders: Headers): String {
val document = page.asJsoup(decodeAtob(page.body.string()))
val iframe = document.selectFirst("iframe")
if (iframe != null) {
return if (iframe != null) {
iframe.attr("src")
} else {
val formUrl = document.selectFirst("form")!!.attr("action")
@ -44,7 +43,6 @@ class RedplayBypasser(
.let { getIframeUrl(it, newHeaders) }
}
}
}
private fun decodeAtob(html: String): String {
val atobContent = html.substringAfter("atob(\"").substringBefore("\"));")

View File

@ -45,7 +45,7 @@ class Cinemathek : DooPlay(
// ============================ Video Links =============================
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)!!
return players.parallelCatchingFlatMapBlocking { player ->
val url = getPlayerUrl(player).takeUnless(String::isEmpty)!!
@ -60,7 +60,7 @@ class Cinemathek : DooPlay(
if (num == "trailer") return ""
return client.newCall(GET("$baseUrl/wp-json/dooplayer/v2/$id/$type/$num"))
.await()
.use { it.body.string() }
.body.string()
.substringAfter("\"embed_url\":\"")
.substringBefore("\",")
.replace("\\", "")

View File

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

View File

@ -9,8 +9,7 @@ import okhttp3.OkHttpClient
import okhttp3.Response
class LinkfunBypasser(private val client: OkHttpClient) {
fun getIframeUrl(response: Response): String {
return response.use { page ->
fun getIframeUrl(page: Response): String {
val docString = page.body.string()
val document = if (docString.startsWith("<script")) {
page.asJsoup(decodeAtob(docString))
@ -20,7 +19,7 @@ class LinkfunBypasser(private val client: OkHttpClient) {
val iframe = document.selectFirst("iframe[src]")
if (iframe != null) {
return if (iframe != null) {
iframe.attr("src")
} else {
val formBody = FormBody.Builder().apply {
@ -32,8 +31,7 @@ class LinkfunBypasser(private val client: OkHttpClient) {
val formUrl = document.selectFirst("form")!!.attr("action")
client.newCall(POST(formUrl, newHeaders, formBody))
.execute()
.use(::getIframeUrl)
}
.let(::getIframeUrl)
}
}

View File

@ -54,7 +54,7 @@ class Kinoking : DooPlay(
// ============================ Video Links =============================
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)!!
return players.flatMap { player ->
runCatching {
@ -73,7 +73,7 @@ class Kinoking : DooPlay(
.build()
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute()
.use { response ->
.let { response ->
response.body.string()
.substringAfter("\"embed_url\":\"")
.substringBefore("\",")

View File

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

View File

@ -27,7 +27,7 @@ class PiFansubs : DooPlay(
// ============================ Video Links =============================
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")
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> {
val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() }
.asJsoup()
val script = doc.selectFirst("script:containsData(player =)")
?.data()

View File

@ -34,7 +34,7 @@ class Pobreflix : DooPlay(
private val superflixExtractor by lazy { SuperFlixExtractor(client, headers, ::genericExtractor) }
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 {
runCatching {
val data = it.attr("href").toHttpUrl().queryParameter("auth")

View File

@ -30,12 +30,11 @@ class EplayerExtractor(private val client: OkHttpClient) {
.add("r", "")
.build()
val masterUrl = client.newCall(POST(postUrl, headers, body = body)).execute().use {
it.body.string()
val masterUrl = client.newCall(POST(postUrl, headers, body = body)).execute()
.body.string()
.substringAfter("videoSource\":\"")
.substringBefore('"')
.replace("\\", "")
}
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 {
val response = client.newCall(GET(url, headers)).execute()
val body = response.use { it.body.string() }
val body = response.body.string()
val codePart = body
.substringAfter("sniff(") // Video function

View File

@ -43,7 +43,7 @@ class SuperFlixExtractor(
.set("origin", API_DOMAIN)
.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 apiUrl = "$baseUrl/ajax_sources.php"
@ -65,7 +65,7 @@ class SuperFlixExtractor(
.build()
val req = client.newCall(POST(apiUrl, apiHeaders, formBody)).await()
.use { it.body.string() }
.body.string()
runCatching {
val iframeUrl = json.decodeFromString<PlayerLinkDto>(req).iframe!!
@ -82,7 +82,7 @@ class SuperFlixExtractor(
data class PlayerLinkDto(val iframe: String? = null)
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 target = it.attr("data-target")
@ -113,7 +113,7 @@ class SuperFlixExtractor(
.build()
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
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ class DopeFlixExtractor(private val client: OkHttpClient) {
}
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 ")
.substringBefore("()")
.substringBeforeLast(",")

View File

@ -129,7 +129,7 @@ class AnimeWorldIndia(
}
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 seasonsJson = json.decodeFromString<List<SeasonDto>>(
@ -189,7 +189,7 @@ class AnimeWorldIndia(
private val mystreamExtractor by lazy { MyStreamExtractor(client, headers) }
override fun videoListParse(response: Response): List<Video> {
val body = response.use { it.body.string() }
val body = response.body.string()
val documentTrimmed = body
.substringAfterLast("\"players\":")
.substringBefore(",\"noplayer\":")

View File

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

View File

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

View File

@ -80,7 +80,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
}
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 position = response.request.url.queryParameter("start")?.toIntOrNull() ?: 0
return AnimesPage(animeList, position + 36 < parsed.total)
@ -110,7 +110,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
}
override fun searchAnimeParse(response: Response): AnimesPage {
val bod = response.use { it.body.string() }
val bod = response.body.string()
val total: Int
val items =
if (response.request.url.encodedPath.contains("search")) {
@ -162,7 +162,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
val response = noTokenClient.newCall(
POST("https://graphql.anilist.co", body = requestBody),
).execute().use { it.body.string() }
).execute().body.string()
val responseParsed = json.decodeFromString<AnilistResult>(response)
@ -183,7 +183,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
} else {
GET("$crApiUrl/cms/movie_listings/${mediaId.id}?locale=en-US")
},
).execute().use { it.body.string() }
).execute().body.string()
val info = json.decodeFromString<AnimeResult>(resp)
return info.data.first().toSAnimeOrNull(anime) ?: anime
}
@ -202,7 +202,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
}
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 chunkSize = Runtime.getRuntime().availableProcessors()
return if (series) {
@ -224,7 +224,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
private fun getEpisodes(seasonData: SeasonResult.Season): List<SEpisode> {
val body =
client.newCall(GET("$crApiUrl/cms/seasons/${seasonData.id}/episodes"))
.execute().use { it.body.string() }
.execute().body.string()
val episodes = json.decodeFromString<EpisodeResult>(body)
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> {
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 subLocale = preferences.getString(PREF_SUB_KEY, PREF_SUB_DEFAULT)!!.getLocale()
@ -308,7 +308,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
runCatching {
val playlist = client.newCall(GET(stream.url)).execute()
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 {
val hardsub = stream.hardsub_locale.let { hs ->
if (hs.isNotBlank()) " - HardSub: $hs" else ""

View File

@ -48,7 +48,7 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
GET("$baseUrl/en/today-hot?page=$page", headers)
override fun popularAnimeParse(response: Response): AnimesPage {
val document = response.use { it.asJsoup() }
val document = response.asJsoup()
val entries = document.select("div.thumbnail").map { element ->
SAnime.create().apply {
@ -95,7 +95,7 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
override fun searchAnimeParse(response: Response) = popularAnimeParse(response)
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 siteCover = document.selectFirst("video.player")?.attr("abs:data-poster")
@ -143,7 +143,7 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
}
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))")
?.data()

View File

@ -93,7 +93,7 @@ class SupJav(override val lang: String = "en") : ConfigurableAnimeSource, Parsed
}
private fun searchAnimeByIdParse(response: Response): AnimesPage {
val details = animeDetailsParse(response.use { it.asJsoup() })
val details = animeDetailsParse(response.asJsoup())
return AnimesPage(listOf(details), false)
}
@ -143,7 +143,7 @@ class SupJav(override val lang: String = "en") : ConfigurableAnimeSource, Parsed
// ============================ Video Links =============================
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()
.filter { it.text() in SUPPORTED_PLAYERS }
@ -176,7 +176,7 @@ class SupJav(override val lang: String = "en") : ConfigurableAnimeSource, Parsed
"VOE" -> voeExtractor.videosFromUrl(url)
"FST" -> streamwishExtractor.videosFromUrl(url)
"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 = '", "")
.substringBefore("';")
.takeUnless(String::isEmpty)

View File

@ -146,7 +146,7 @@ class Anime4Up : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
)
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")
?.let { String(Base64.decode(it, Base64.DEFAULT)) }
?: 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 playerUrl = "$VIDYARD_URL/player/$id.json"
val callPlayer = client.newCall(GET(playerUrl, newHeaders)).execute()
.use { it.body.string() }
.body.string()
val data = callPlayer.substringAfter("hls\":[").substringBefore("]")
val sources = data.split("profile\":\"").drop(1)

View File

@ -138,7 +138,7 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() }
val document = response.asJsoup()
return document.select("span.server a").flatMap {
runCatching { extractVideos(it) }.getOrElse { emptyList() }
}
@ -152,7 +152,7 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return when {
".vid4up" in url || "Blkom" in element.text() -> {
val videoDoc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() }
.asJsoup()
videoDoc.select(videoListSelector()).map(::videoFromElement)
}
"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()
// ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> {
return response.use { videosFromElement(it.asJsoup()) }
}
override fun videoListParse(response: Response) = videosFromElement(response.asJsoup())
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 episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() }
val document = response.asJsoup()
if (document.location().contains("/movies/")) {
return listOf(
SEpisode.create().apply {
@ -129,7 +129,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return document.select(episodeListSelector()).flatMap { el ->
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 seasonNum = seasonName.substringAfterLast(" ").toIntOrNull() ?: 1
doc.select(episodeListSelector()).map {
@ -151,7 +151,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() }
val document = response.asJsoup()
val players = document.select(videoListSelector())
return players.parallelCatchingFlatMapBlocking(::getPlayerVideos)
}
@ -200,7 +200,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute()
.use { response ->
.let { response ->
response.body.string()
.substringAfter("\"embed_url\":\"")
.substringBefore("\",")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ class Aniking : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun episodeListSelector() = throw UnsupportedOperationException()
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) {
val episodeElement = document.selectFirst("script[id=\"tv-js-after\"]")!!
episodeElement.data()

View File

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

View File

@ -33,14 +33,14 @@ class VidGuardExtractor(private val client: OkHttpClient) {
}
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]")
?.absUrl("src")
?: return emptyList()
val headers = Headers.headersOf("Referer", url)
val script = client.newCall(GET(scriptUrl, headers)).execute()
.use { it.body.string() }
.body.string()
val sources = getSourcesFromScript(script, url)
.takeIf { it.isNotBlank() && it != "undefined" }

View File

@ -87,7 +87,7 @@ class Einfach : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}
private fun searchAnimeByPathParse(response: Response): AnimesPage {
val details = animeDetailsParse(response.use { it.asJsoup() })
val details = animeDetailsParse(response.asJsoup())
return AnimesPage(listOf(details), false)
}
@ -154,7 +154,7 @@ class Einfach : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links =============================
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)!!

View File

@ -16,7 +16,7 @@ class MyStreamExtractor(private val client: OkHttpClient, private val headers: H
return runCatching {
val response = client.newCall(GET(url, headers)).execute()
val body = response.use { it.body.string() }
val body = response.body.string()
val codePart = body
.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> {
val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() }
.asJsoup()
val script = doc.selectFirst("script:containsData(eval)")
?.data()

View File

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

View File

@ -140,7 +140,7 @@ class FilmPalast : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
"wolfstream" in url && hosterSelection.contains("wolf") -> {
client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() }
.asJsoup()
.selectFirst("script:containsData(sources)")
?.data()
?.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> {
val doc = client.newCall(GET(url, headers)).execute()
.use { it.asJsoup() }
.asJsoup()
val script = doc.selectFirst("script:containsData(eval)")
?.data()

View File

@ -33,14 +33,14 @@ class VidGuardExtractor(private val client: OkHttpClient) {
}
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]")
?.absUrl("src")
?: return emptyList()
val headers = Headers.headersOf("Referer", url)
val script = client.newCall(GET(scriptUrl, headers)).execute()
.use { it.body.string() }
.body.string()
val sources = getSourcesFromScript(script, url)
.takeIf { it.isNotBlank() && it != "undefined" }

View File

@ -85,7 +85,7 @@ class StreamCloud : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================== Episodes ==============================
override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.use { it.asJsoup() }
val document = response.asJsoup()
val episode = SEpisode.create().apply {
name = document.selectFirst("#title span.title")!!.text()
episode_number = 1F
@ -104,11 +104,11 @@ class StreamCloud : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private val mixdropExtractor by lazy { MixDropExtractor(client) }
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")
?.attr("src")
?: 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 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> {
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)")
@ -177,7 +177,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val url = it.selectFirst("a")!!.attr("href")
val episodesDocument = client.newCall(GET(url)).execute()
.use { it.asJsoup() }
.asJsoup()
episodesDocument.select("div.entry-content > h3 > a").map {
EpUrl(quality, it.attr("href"), "Season $seasonNumber ${it.text()}")
}
@ -194,7 +194,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// Load episodes
val serversList = driveList.map { drive ->
val episodesDocument = client.newCall(GET(drive.first)).execute()
.use { it.asJsoup() }
.asJsoup()
episodesDocument.select("div.entry-content > h3 > a").map {
EpUrl(drive.second, it.attr("href"), it.text())
}
@ -225,14 +225,14 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val leechUrls = urls.map {
val firstLeech = client.newCall(GET(it.url)).execute()
.use { it.asJsoup() }
.asJsoup()
.selectFirst("script:containsData(downlaod_button)")!!
.data()
.substringAfter("<a href=\"")
.substringBefore("\">")
val path = client.newCall(GET(firstLeech)).execute()
.use { it.body.string() }
.body.string()
.substringAfter("replace(\"")
.substringBefore("\"")
@ -277,7 +277,7 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private fun extractWorkerLinks(mediaUrl: String, quality: String, type: Int): List<Video> {
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 size = sizeMatch?.groups?.get(1)?.value?.let { " - $it" } ?: ""
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? {
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)")
?.data()
?: return url
@ -314,18 +314,18 @@ class AnimeFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val req = client.newCall(POST(url.replace("/file/", newPath), headers, form)).execute()
return runCatching {
json.decodeFromString<DriveLeechDirect>(req.use { it.body.string() }).url
json.decodeFromString<DriveLeechDirect>(req.body.string()).url
}.getOrNull()
}
private fun extractGDriveLink(mediaUrl: String, quality: String): List<Video> {
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 gdLink = gdBtn.attr("href")
val sizeMatch = SIZE_REGEX.find(gdBtn.text())
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")
return if (link.isNullOrEmpty()) {
emptyList()

View File

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

View File

@ -118,7 +118,7 @@ class AnimeParadise : ConfigurableAnimeSource, AnimeHttpSource() {
}
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()
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 videoListParse(response: Response): List<Video> {
val document = response.use { it.asJsoup() }
val document = response.asJsoup()
val data = json.decodeFromString<VideoData>(
document.selectFirst("script#__NEXT_DATA__")!!.data(),
).props.pageProps

View File

@ -104,7 +104,7 @@ class AnimeUI : ConfigurableAnimeSource, AnimeHttpSource() {
override fun animeDetailsRequest(anime: SAnime) = GET(baseUrl + anime.url, docHeaders)
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()
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 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()
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 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 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) }
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 {
it.attr("data-video")

View File

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

View File

@ -78,7 +78,7 @@ class DramaCool : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// =========================== Anime Details ============================
override fun animeDetailsRequest(anime: SAnime): Request {
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"))
}
return GET(baseUrl + anime.url)
@ -119,9 +119,9 @@ class DramaCool : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun videoListSelector() = "ul.list-server-items li"
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 iframeDoc = client.newCall(GET(iframeUrl)).execute().use { it.asJsoup() }
val iframeDoc = client.newCall(GET(iframeUrl)).execute().asJsoup()
return iframeDoc.select(videoListSelector()).flatMap(::videosFromElement)
}

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