Skip to content

Commit

Permalink
Merge pull request #40 from Dark25/Hackstore
Browse files Browse the repository at this point in the history
Feat(es/Hackstore): Add GoodStreamExtractor
  • Loading branch information
Dark25 authored Aug 17, 2024
2 parents 14cbb45 + 0dcb92c commit d1efe97
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
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

0 comments on commit d1efe97

Please sign in to comment.