-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hi/yomovies): Add Minoplres extractor (#2256)
- Loading branch information
1 parent
fe94803
commit 98c2c7c
Showing
4 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
...ovies/src/eu/kanade/tachiyomi/animeextension/hi/yomovies/extractors/MinoplresExtractor.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package eu.kanade.tachiyomi.animeextension.hi.yomovies.extractors | ||
|
||
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 MinoplresExtractor(private val client: OkHttpClient, private val headers: Headers) { | ||
private val playlistUtils by lazy { PlaylistUtils(client, headers) } | ||
|
||
fun videosFromUrl(url: String, name: String): List<Video> { | ||
val newHeaders = headers.newBuilder().set("Referer", url).build() | ||
val doc = client.newCall(GET(url, newHeaders)).execute() | ||
.use { it.asJsoup() } | ||
val script = doc.selectFirst("script:containsData(sources:)")?.data() | ||
?: return emptyList() | ||
|
||
val masterUrl = script.substringAfter("file:\"").substringBefore('"') | ||
return playlistUtils.extractFromHls( | ||
masterUrl, | ||
referer = url, | ||
videoNameGen = { "$name Minoplres - $it" }, | ||
) | ||
} | ||
} |
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