Template repository for building sources extensions for FireStream.
Android studio
A source has:
- properties (name, a url ...)
- A loadLinks function: This functions is called with an argument SourceRequest("Big Buck Bunny", TvType.Movie) and has to find links to the video, and optionally find subtitles
ExampleExtension/
├── build.gradle.kts => The in-app displayed name, language and author are editable here
├── icon.png
└── src/main/
├── AndroidManifest.xml
└── kotlin/recloudstream/
├── ExampleSource.kt => The source is written here
└── ExamplePlugin.kt => The plugin tells FireStream that it has to use the source
- First, copy paste this "ExampleExtension" folder
- Right click the folder and click rename directory, rename it to what you want (ex: "ThisCoolWebsiteExtension")
- Edit the details in build.gradle.kts (optionally change the icon.png)
- In android studio, rigth click the ExampleSource file, click "refactor" and then "rename", rename the source to what you (keep "Source" at the end of the name), ex: "ThisCoolWebsiteSource".
- In android studio, rigth click the ExamplePlugin file, click "refactor" and then "rename", rename the plugin to what you want (keep "Plugin" at the end of the name): ex: "ThisCoolWebsitePlugin"
Here you have to understand how the website builds the video file (ending with .m3u8, .mkv, or .mp4). You need to implement those steps in kotlin to programatically build the video file link from the source request: SourceRequest("Big Buck Bunny", TvType.Movie, 2008).
You will often have to re-implement a search function to find the wanted media (here the movie Big Buck Bunny).
Once you found the video link you have to tell the app that you found it using the callback function:
callback(
newExtractorLink(
"sourcename",
"Big Buck Bunny 8K 120 fps",
"https://linktothevideofile.com/BigBuckBunny.m3u8",
ExtractorLinkType.m3u8, // You have to replace the ExtractorLinkType.m3u8 with ExtractorLinkType.VIDEO if its not an m3u8
) {
this.referer = "https://thewebsite.com/" // WARNING almost always required !, the link wont play without this
this.quality = Qualities.Unknown.value
}
)
You can checkout this amazing scrapping tutorial to learn more about this step: https://github.com/Blatzar/scraping-tutorial/blob/master/starting.md
Dont forget to add your source to those files (if not already added):
SourceTester/build.gradle.kts:
implementation(project(":ExampleExtension"))and here:
SourceTester/src/test/kotlin/recloudstream/tester/SourceRunner.kt:
import recloudstream.ExampleSource
// ...
private val sources: List<SourceApi> = listOf(
// ...
ExampleSource(),
)You can now run those commands to test your source:
./gradlew :SourceTester:run --source MyExampleSourceId
./gradlew :SourceTester:run --source MyExampleSourceId -Ptitle="Big Buck Bunny" -Pyear=2008 -Ptmdb=10378 # This will look for the movie Big Buck Bunny on the website, the attributes -Pepisode and -Pseason are also available for tv shows
./gradlew :SourceTester:run # runs every registered source
--source matches against a source's id or name; omit it to run everything. This is the fast loop for iterating — no APK build, no emulator, just loadLinks and stdout.