forked from aniyomiorg/aniyomi-extensions
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pt/Pobreflix): Update extension (#112)
- Loading branch information
Showing
5 changed files
with
62 additions
and
81 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
56 changes: 0 additions & 56 deletions
56
...lix/src/eu/kanade/tachiyomi/animeextension/pt/pobreflix/extractors/FireplayerExtractor.kt
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...lix/src/eu/kanade/tachiyomi/animeextension/pt/pobreflix/extractors/PlayerFlixExtractor.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,35 @@ | ||
package eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors | ||
|
||
import eu.kanade.tachiyomi.animesource.model.Video | ||
import eu.kanade.tachiyomi.network.GET | ||
import eu.kanade.tachiyomi.util.asJsoup | ||
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking | ||
import okhttp3.Headers | ||
import okhttp3.OkHttpClient | ||
|
||
class PlayerFlixExtractor( | ||
private val client: OkHttpClient, | ||
private val defaultHeaders: Headers, | ||
private val genericExtractor: (String, String) -> List<Video>, | ||
) { | ||
fun videosFromUrl(url: String): List<Video> { | ||
val doc = client.newCall(GET(url, defaultHeaders)).execute().asJsoup() | ||
|
||
val items = doc.select("#hostList div.buttonLoadHost").mapNotNull { | ||
val url = it.attr("onclick") | ||
.substringAfter('"', "") | ||
.substringBefore('"') | ||
?: return@mapNotNull null | ||
|
||
val language = if (it.hasClass("hostDub")) { | ||
"Dublado" | ||
} else { | ||
"Legendado" | ||
} | ||
|
||
language to url // (Language, videoId) | ||
} | ||
|
||
return items.parallelCatchingFlatMapBlocking { genericExtractor(it.second, it.first) } | ||
} | ||
} |
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