fix(lib/lycoris&lulu) Repair decode json and work LuluStream #810
2 changed files with 13 additions and 12 deletions
|
@ -6,23 +6,24 @@ import okhttp3.Headers
|
|||
import okhttp3.OkHttpClient
|
||||
![]() Well, not entirely the same if the current one has a user-agent from the application and the previous form relied solely on these 2 headers. Well, not entirely the same if the current one has a user-agent from the application and the previous form relied solely on these 2 headers.
I don't understand which Regex you mean :(
![]() Just change the Just change the `Headers.Builder()` to `headers.Builder()` then. Keep it outside like you did with the wordRegex previously.
if you meant creating a header based on parameter `headers` passed in to the function, find where the actual function called and restructure it so the original caller should pass the existed lulu one.
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class LuluExtractor(private val client: OkHttpClient) {
|
||||
//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()
|
||||
class LuluExtractor(private val client: OkHttpClient, headers: Headers) {
|
||||
|
||||
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>()
|
||||
|
||||
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 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) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class Docchi : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||
private val sibnetExtractor by lazy { SibnetExtractor(client) }
|
||||
private val doodExtractor by lazy { DoodExtractor(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) }
|
||||
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
|
@ -203,7 +203,7 @@ class Docchi : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||
}
|
||||
|
||||
serverUrl.contains("luluvdo.com") -> {
|
||||
luluExtractor.videosFromUrl(serverUrl, prefix, headers)
|
||||
luluExtractor.videosFromUrl(serverUrl, prefix)
|
||||
}
|
||||
|
||||
serverUrl.contains("drive.google.com") -> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue
It's exact the same as the old headers, why need a new one?
Also, where it was, outside, is better. Same as the Regex one.