forked from aniyomiorg/aniyomi-extensions
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(src/es): Add New source AnimeBum and update extractors (#98)
* feat(src/es): Add New source AnimeBum and update extractors * fix klint
- Loading branch information
Showing
26 changed files
with
432 additions
and
36 deletions.
There are no files selected for viewing
53 changes: 38 additions & 15 deletions
53
...or/src/main/java/eu/kanade/tachiyomi/lib/streamhidevidextractor/StreamHideVidExtractor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,48 @@ | ||
package eu.kanade.tachiyomi.lib.streamhidevidextractor | ||
|
||
import android.util.Log | ||
import dev.datlag.jsunpacker.JsUnpacker | ||
import eu.kanade.tachiyomi.animesource.model.Video | ||
import eu.kanade.tachiyomi.lib.playlistutils.PlaylistUtils | ||
import eu.kanade.tachiyomi.network.GET | ||
import eu.kanade.tachiyomi.util.asJsoup | ||
import okhttp3.Headers | ||
import okhttp3.OkHttpClient | ||
|
||
class StreamHideVidExtractor(private val client: OkHttpClient) { | ||
|
||
private val playlistUtils by lazy { PlaylistUtils(client) } | ||
|
||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> { | ||
val page = client.newCall(GET(url)).execute().body.string() | ||
val playlistUrl = (JsUnpacker.unpackAndCombine(page) ?: page) | ||
.substringAfter("sources:") | ||
.substringAfter("file:\"") // StreamHide | ||
.substringAfter("src:\"") // StreamVid | ||
.substringBefore('"') | ||
if (!playlistUrl.startsWith("http")) return emptyList() | ||
return playlistUtils.extractFromHls(playlistUrl, | ||
videoNameGen = { "${prefix}StreamHideVid - $it" } | ||
) | ||
class StreamHideVidExtractor(private val client: OkHttpClient, private val headers: Headers) { | ||
|
||
|
||
private val playlistUtils by lazy { PlaylistUtils(client, headers) } | ||
|
||
fun videosFromUrl(url: String, videoNameGen: (String) -> String = { quality -> "StreamHideVid - $quality" }): List<Video> { | ||
|
||
val doc = client.newCall(GET(getEmbedUrl(url), headers)).execute().asJsoup() | ||
|
||
val scriptBody = doc.selectFirst("script:containsData(m3u8)")?.data() | ||
?.let { script -> | ||
if (script.contains("eval(function(p,a,c")) { | ||
JsUnpacker.unpackAndCombine(script) | ||
} else { | ||
script | ||
} | ||
} | ||
val masterUrl = scriptBody | ||
?.substringAfter("source", "") | ||
?.substringAfter("file:\"", "") | ||
?.substringBefore("\"", "") | ||
?.takeIf(String::isNotBlank) | ||
?: return emptyList() | ||
|
||
Log.d("StreamHideVidExtractor", "Playlist URL: $masterUrl") | ||
return playlistUtils.extractFromHls(masterUrl, url, videoNameGen = videoNameGen) | ||
} | ||
|
||
private fun getEmbedUrl(url: String): String { | ||
return when { | ||
url.contains("/d/") -> url.replace("/d/", "/v/") | ||
url.contains("/download/") -> url.replace("/download/", "/v/") | ||
url.contains("/file/") -> url.replace("/file/", "/v/") | ||
else -> url.replace("/f/", "/v/") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ext { | ||
extName = 'AnimeBum' | ||
extClass = '.AnimeBum' | ||
extVersionCode = 1 | ||
} | ||
|
||
apply from: "$rootDir/common.gradle" | ||
|
||
dependencies { | ||
implementation(project(':lib:okru-extractor')) | ||
implementation(project(':lib:streamwish-extractor')) | ||
implementation(project(':lib:universal-extractor')) | ||
implementation(project(':lib:streamhidevid-extractor')) | ||
implementation(project(':lib:vidguard-extractor')) | ||
implementation(project(':lib:filemoon-extractor')) | ||
implementation(project(':lib:gdriveplayer-extractor')) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.