Skip to content

Commit 38bb369

Browse files
errorcodeQQerrorcodeQQ
authored andcommitted
refactor: clean up comments and add BinTV plugin
1 parent 5fee899 commit 38bb369

15 files changed

Lines changed: 1113 additions & 426 deletions

File tree

AniZen/src/main/kotlin/com/anizen/AniZenProvider.kt

Lines changed: 19 additions & 130 deletions
Large diffs are not rendered by default.

AniZen/src/main/kotlin/com/anizen/MegaPlayBuzzExtractor.kt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import com.lagradost.cloudstream3.utils.newExtractorLink
99
import android.util.Log
1010

1111
/**
12-
* Custom extractor for MegaPlay.buzz embed URLs used by AniZen.
13-
*
14-
* The embed URL pattern is: https://megaplay.buzz/stream/s-2/{serverId}/{sub|dub}
15-
* This extractor loads the embed page and extracts the underlying .m3u8 video source.
12+
* Extractor for MegaPlay.buzz embed URLs.
1613
*/
1714
open class MegaPlayBuzzExtractor : ExtractorApi() {
1815
override val name = "MegaPlay"
@@ -47,8 +44,7 @@ open class MegaPlayBuzzExtractor : ExtractorApi() {
4744

4845
val html = response.text
4946

50-
// ── Strategy 1: JWPlayer / Video.js config ──────────────────────────
51-
// Pattern: file: "https://...m3u8" or source: "https://...m3u8"
47+
// Config patterns (JWPlayer, Video.js)
5248
val filePatterns = listOf(
5349
Regex("""["']file["']\s*:\s*["']([^"']+\.m3u8[^"']*)["']"""),
5450
Regex("""source\s*:\s*["']([^"']+\.m3u8[^"']*)["']"""),
@@ -71,7 +67,7 @@ open class MegaPlayBuzzExtractor : ExtractorApi() {
7167
}
7268
}
7369

74-
// ── Strategy 2: HTML5 <source> tag ───────────────────────────────────
70+
// HTML5 source tag
7571
val sourceTag = response.document.selectFirst("source[src]")
7672
if (sourceTag != null) {
7773
val src = sourceTag.attr("src")
@@ -88,7 +84,7 @@ open class MegaPlayBuzzExtractor : ExtractorApi() {
8884
}
8985
}
9086

91-
// ── Strategy 3: Bare .m3u8 URLs in the page ─────────────────────────
87+
// Bare m3u8 links
9288
val m3u8Pattern = Regex("""(https?://[^\s"'<>\\]+\.m3u8[^\s"'<>\\]*)""")
9389
val m3u8Matches = m3u8Pattern.findAll(html).toList()
9490
if (m3u8Matches.isNotEmpty()) {
@@ -105,9 +101,7 @@ open class MegaPlayBuzzExtractor : ExtractorApi() {
105101
return
106102
}
107103

108-
// ── Strategy 4: Vidstream / MegaPlay API pattern ─────────────────────
109-
// Some embeds use a JS-driven approach where the source is fetched
110-
// via an API call. Look for API endpoints in the page.
104+
// API request pattern
111105
val apiPattern = Regex("""(?:ajax|api|source|embed)\s*[=:]\s*["']([^"']+)["']""")
112106
for (match in apiPattern.findAll(html)) {
113107
val apiPath = match.groupValues[1]
@@ -117,7 +111,7 @@ open class MegaPlayBuzzExtractor : ExtractorApi() {
117111
val apiResp = app.get(apiUrl, headers = headers + ("Referer" to url))
118112
val apiText = apiResp.text
119113

120-
// Look for m3u8 in the API response
114+
// Search in API response
121115
val apiM3u8 = m3u8Pattern.find(apiText)
122116
if (apiM3u8 != null) {
123117
val m3u8Url = apiM3u8.groupValues[1]
@@ -131,7 +125,7 @@ open class MegaPlayBuzzExtractor : ExtractorApi() {
131125
return
132126
}
133127

134-
// Try parsing as JSON
128+
// Parse JSON response
135129
if (apiText.trimStart().startsWith("{")) {
136130
try {
137131
val jsonData = parseJson<Map<String, Any?>>(apiText)
@@ -159,7 +153,7 @@ open class MegaPlayBuzzExtractor : ExtractorApi() {
159153
}
160154
}
161155

162-
// ── Strategy 5: Nested iframe ────────────────────────────────────────
156+
// Nested iframe HLS
163157
val nestedIframe = response.document.selectFirst("iframe[src]")
164158
if (nestedIframe != null) {
165159
val nestedSrc = nestedIframe.attr("src")

AniZen/src/test/kotlin/com/anizen/AniZenProviderTest.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ import com.lagradost.cloudstream3.TvType
66
import com.lagradost.cloudstream3.AnimeSearchResponse
77

88
/**
9-
* Local JVM unit tests for AniZenProvider.
10-
*
11-
* These tests verify the core parsing logic and data extraction
12-
* from the AniZen website's RSC payloads.
13-
*
14-
* Run with: ./gradlew :AniZen:test --info
9+
* JVM unit tests for AniZenProvider.
1510
*/
1611
class AniZenProviderTest {
1712
private val provider = AniZenProvider()

BinTV/build.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version = 7
2+
3+
cloudstream {
4+
description = "BINTV Live Sport 4k only work in high end device with 4k support otherwise you make face lag. (v7: switched to old.ppv.to + dedicated embedindia.st extractor)"
5+
authors = listOf("errorcodeQQ")
6+
status = 1
7+
tvTypes = listOf("Live")
8+
language = "en"
9+
iconUrl = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsQsag_KQPokaomZsgDV4fiXQ_fi494N6wV8cwKyQQuhSnOh1pAl4lV2Ur-yHCG6IFBimoeWaZKiOTQyyEmfYLetghJRbhyoTHZuzfbZ9VOWZV5aNE4L4akyYmk5D1sB-QLzVQLy200JxziBg0Wwetdxb0Ybf7oqv4R1W8t49rsYLsFkLHZuNPL42I8Q/s512/letter-b.png"
10+
}
11+
12+
android {
13+
namespace = "com.bintv"
14+
compileSdk = 35
15+
defaultConfig {
16+
minSdk = 21
17+
}
18+
buildFeatures {
19+
viewBinding = false
20+
buildConfig = true
21+
}
22+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.bintv
2+
3+
import com.lagradost.cloudstream3.plugins.BasePlugin
4+
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
5+
6+
@CloudstreamPlugin
7+
class BinTVPlugin : BasePlugin() {
8+
override fun load() {
9+
// Register provider
10+
registerMainAPI(BinTVProvider())
11+
}
12+
}

0 commit comments

Comments
 (0)