Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(es/Hackstore): Add GoodStreamExtractor #40

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/goodstream-extractor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("lib-android")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package eu.kanade.tachiyomi.lib.goodstramextractor

import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Headers
import okhttp3.OkHttpClient

class GoodStreamExtractor(private val client: OkHttpClient, private val headers: Headers) {

fun videosFromUrl(url: String, name: String): List<Video> {
val doc = client.newCall(GET(url, headers)).execute().asJsoup()
val videos = mutableListOf<Video>()

doc.select("script").forEach { script ->
if (script.data().contains(Regex("file|player"))) {
val urlRegex = Regex("file: \"(https:\\/\\/[a-z0-9.\\/-_?=&]+)\",")
urlRegex.find(script.data())?.groupValues?.get(1)?.let { link ->
videos.add(
Video(
url = link,
quality = name,
videoUrl = link,
headers = headers
)
)
}
}
}

return videos
}
}
3 changes: 2 additions & 1 deletion src/es/hackstore/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'Hackstore'
extClass = '.Hackstore'
extVersionCode = 15
extVersionCode = 16
}

apply from: "$rootDir/common.gradle"
Expand All @@ -13,4 +13,5 @@ dependencies {
implementation(project(':lib:streamwish-extractor'))
implementation(project(':lib:dood-extractor'))
implementation(project(':lib:vidhide-extractor'))
implementation(project(':lib:goodstream-extractor'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.lib.goodstramextractor.GoodStreamExtractor
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
import eu.kanade.tachiyomi.lib.vidhideextractor.VidHideExtractor
Expand Down Expand Up @@ -179,6 +180,7 @@ class Hackstore : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private val streamWishExtractor by lazy { StreamWishExtractor(client, headers) }
private val doodExtractor by lazy { DoodExtractor(client) }
private val vidHideExtractor by lazy { VidHideExtractor(client, headers) }
private val goodStreamExtractor by lazy { GoodStreamExtractor(client, headers) }

override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
Expand Down Expand Up @@ -207,6 +209,9 @@ class Hackstore : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
server.contains("vidhide") || server.contains("vid.") -> {
vidHideExtractor.videosFromUrl(url) { "$prefix VidHide:$it" }
}
server.contains("goodstream") || server.contains("vidstream") -> {
goodStreamExtractor.videosFromUrl(url, "$prefix GoodStream")
}
else -> emptyList()
}
}
Expand Down Expand Up @@ -247,7 +252,7 @@ class Hackstore : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

private const val PREF_SERVER_KEY = "preferred_server"
private const val PREF_SERVER_DEFAULT = "StreamWish"
private val SERVER_LIST = arrayOf("DoodStream", "StreamTape", "Voe", "Filemoon", "StreamWish")
private val SERVER_LIST = arrayOf("DoodStream", "StreamTape", "Voe", "Filemoon", "StreamWish", "VidHide", "GoodStream")
}

override fun setupPreferenceScreen(screen: PreferenceScreen) {
Expand Down