fix(lib/lycoris&lulu): small change v3
This commit is contained in:
parent
cfdcc6480a
commit
4289c079c5
2 changed files with 13 additions and 12 deletions
|
@ -6,23 +6,24 @@ import okhttp3.Headers
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
class LuluExtractor(private val client: OkHttpClient) {
|
class LuluExtractor(private val client: OkHttpClient, headers: Headers) {
|
||||||
//Credit: https://github.com/skoruppa/docchi-stremio-addon/blob/main/app/players/lulustream.py
|
|
||||||
fun videosFromUrl(url: String, prefix: String, headers: Headers): List<Video> {
|
|
||||||
val luluHeaders = headers.newBuilder()
|
|
||||||
.add("Referer", "https://luluvdo.com")
|
|
||||||
.add("Origin", "https://luluvdo.com")
|
|
||||||
.build()
|
|
||||||
|
|
||||||
|
private val headers = headers.newBuilder()
|
||||||
|
.add("Referer", "https://luluvdo.com")
|
||||||
|
.add("Origin", "https://luluvdo.com")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
//Credit: https://github.com/skoruppa/docchi-stremio-addon/blob/main/app/players/lulustream.py
|
||||||
|
fun videosFromUrl(url: String, prefix: String): List<Video> {
|
||||||
val videos = mutableListOf<Video>()
|
val videos = mutableListOf<Video>()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val html = client.newCall(GET(url, luluHeaders)).execute().use { it.body.string() }
|
val html = client.newCall(GET(url, headers)).execute().use { it.body.string() }
|
||||||
val m3u8Url = extractM3u8Url(html) ?: return emptyList()
|
val m3u8Url = extractM3u8Url(html) ?: return emptyList()
|
||||||
val fixedUrl = fixM3u8Link(m3u8Url)
|
val fixedUrl = fixM3u8Link(m3u8Url)
|
||||||
val quality = getResolution(fixedUrl, luluHeaders)
|
val quality = getResolution(fixedUrl, headers)
|
||||||
|
|
||||||
videos.add(Video(fixedUrl, "${prefix}Lulu - $quality", fixedUrl, luluHeaders))
|
videos.add(Video(fixedUrl, "${prefix}Lulu - $quality", fixedUrl, headers))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ class Docchi : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
private val sibnetExtractor by lazy { SibnetExtractor(client) }
|
private val sibnetExtractor by lazy { SibnetExtractor(client) }
|
||||||
private val doodExtractor by lazy { DoodExtractor(client) }
|
private val doodExtractor by lazy { DoodExtractor(client) }
|
||||||
private val lycorisExtractor by lazy { LycorisCafeExtractor(client) }
|
private val lycorisExtractor by lazy { LycorisCafeExtractor(client) }
|
||||||
private val luluExtractor by lazy { LuluExtractor(client) }
|
private val luluExtractor by lazy { LuluExtractor(client, headers) }
|
||||||
private val googledriveExtractor by lazy { GoogleDriveExtractor(client, headers) }
|
private val googledriveExtractor by lazy { GoogleDriveExtractor(client, headers) }
|
||||||
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
|
@ -203,7 +203,7 @@ class Docchi : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
serverUrl.contains("luluvdo.com") -> {
|
serverUrl.contains("luluvdo.com") -> {
|
||||||
luluExtractor.videosFromUrl(serverUrl, prefix, headers)
|
luluExtractor.videosFromUrl(serverUrl, prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
serverUrl.contains("drive.google.com") -> {
|
serverUrl.contains("drive.google.com") -> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue