@@ -9,10 +9,7 @@ import com.lagradost.cloudstream3.utils.newExtractorLink
99import 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 */
1714open 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" )
0 commit comments