Buckets:
| /** | |
| * ======================================================================== | |
| * UNIVERSAL WEB STREAM PLAYER & PROXY BRIDGE | |
| * ======================================================================== | |
| * | |
| * Huu ni mfumo wa Player unaowezesha link zozote za stream zinazotegemea | |
| * Package Name ya Android (kama com.david.pp) kufunguka na kucheza moja kwa | |
| * moja kwenye kivinjari cha kawaida (Chrome, Safari, Firefox, n.k.) bila | |
| * kuhitaji Android App. | |
| * | |
| * MFUMO HUU UNAFANYA YAFUATAYO: | |
| * 1. Inatuma headers za kipekee (X-Requested-With & Android User-Agent). | |
| * 2. Inashughulikia Token Refresh kiotomatiki (kila sekunde 90) bila video kukata. | |
| * 3. Inashughulikia DRM ClearKey na Leseni bila makosa ya CORS (Cross-Origin). | |
| * 4. Inapokea channel yoyote kupitia URL kamili au Channel ID pekee. | |
| */ | |
| // 1. CHAGUO-MSINGI (CONFIGURATIONS) | |
| define('DEFAULT_PACKAGE', 'com.david.pp'); // Badilisha hapa ikiwa package name itabadilika | |
| define('DEFAULT_CHANNEL_URL', 'https://nur.mpilalivetv.com/v2/player.php?channel=1'); | |
| define('USER_AGENT_MOBILE', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36'); | |
| // 2. PARAMS & ROUTING | |
| $scriptName = basename($_SERVER['SCRIPT_NAME'] ?? 'player.php'); | |
| $packageName = trim((string)($_GET['pkg'] ?? $_GET['package'] ?? $_POST['pkg'] ?? DEFAULT_PACKAGE)); | |
| // Utambuzi wa Link: Inakubali `?url=https://...` au `?channel=1` | |
| $targetUrl = ''; | |
| if (!empty($_GET['url'])) { | |
| $targetUrl = trim($_GET['url']); | |
| } elseif (!empty($_GET['channel'])) { | |
| $targetUrl = 'https://nur.mpilalivetv.com/v2/player.php?channel=' . urlencode($_GET['channel']); | |
| } else { | |
| $targetUrl = DEFAULT_CHANNEL_URL; | |
| } | |
| $parsedOrigin = parse_url($targetUrl); | |
| $baseOrigin = ($parsedOrigin['scheme'] ?? 'https') . '://' . ($parsedOrigin['host'] ?? ''); | |
| // Helper: HTTP Request Forwarder yenye Package Name | |
| function forwardStreamRequest(string $url, string $pkg, string $referer, ?string $postBody = null, bool $isBinary = false): array { | |
| $ch = curl_init($url); | |
| $headers = [ | |
| 'User-Agent: ' . USER_AGENT_MOBILE, | |
| 'X-Requested-With: ' . $pkg, | |
| 'Referer: ' . $referer . '/', | |
| 'Accept: */*' | |
| ]; | |
| if ($postBody !== null) { | |
| curl_setopt($ch, CURLOPT_POST, true); | |
| curl_setopt($ch, CURLOPT_POSTFIELDS, $postBody); | |
| if ($isBinary) $headers[] = 'Content-Type: application/octet-stream'; | |
| } | |
| curl_setopt_array($ch, [ | |
| CURLOPT_RETURNTRANSFER => true, | |
| CURLOPT_HTTPHEADER => $headers, | |
| CURLOPT_FOLLOWLOCATION => true, | |
| CURLOPT_SSL_VERIFYPEER => false, | |
| CURLOPT_SSL_VERIFYHOST => false, | |
| CURLOPT_TIMEOUT => 20 | |
| ]); | |
| $body = curl_exec($ch); | |
| $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
| $mime = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); | |
| curl_close($ch); | |
| return ['code' => (int)$code, 'mime' => (string)$mime, 'body' => (string)$body]; | |
| } | |
| // 3. DRM LICENSE PROXY FORWARDER | |
| if (isset($_GET['proxy_license']) || (isset($_GET['license_url']))) { | |
| $licenseUrl = (string)($_GET['license_url'] ?? $_GET['url'] ?? ''); | |
| $baseHost = rtrim((string)($_GET['base'] ?? $baseOrigin), '/'); | |
| $licensePath = $baseHost . '/license_proxy.php?url=' . urlencode($licenseUrl); | |
| $res = forwardStreamRequest($licensePath, $packageName, $baseOrigin, file_get_contents('php://input'), true); | |
| http_response_code($res['code']); | |
| if ($res['mime']) header('Content-Type: ' . $res['mime']); | |
| header('Access-Control-Allow-Origin: *'); | |
| header('Access-Control-Allow-Methods: POST, GET, OPTIONS'); | |
| header('Access-Control-Allow-Headers: *'); | |
| echo $res['body']; | |
| exit; | |
| } | |
| // 4. AJAX TOKEN REFRESH FORWARDER (Inaitwa kila sekunde 90 na Player) | |
| if (isset($_GET['ajax']) || isset($_GET['refresh'])) { | |
| $sep = (strpos($targetUrl, '?') !== false) ? '&' : '?'; | |
| $refreshUrl = $targetUrl . $sep . 'ajax=1&refresh=1&_t=' . (string)($_GET['_t'] ?? round(microtime(true) * 1000)); | |
| $res = forwardStreamRequest($refreshUrl, $packageName, $baseOrigin); | |
| http_response_code($res['code']); | |
| header('Content-Type: application/json; charset=utf-8'); | |
| header('Access-Control-Allow-Origin: *'); | |
| echo $res['body']; | |
| exit; | |
| } | |
| // 5. FETCH & RENDER THE MAIN WEB PLAYER | |
| $res = forwardStreamRequest($targetUrl, $packageName, $baseOrigin); | |
| http_response_code($res['code']); | |
| if ($res['code'] !== 200 || empty($res['body'])) { | |
| header('Content-Type: text/html; charset=utf-8'); | |
| echo "<div style='background:#0f172a;color:#f87171;padding:24px;font-family:sans-serif;border-radius:12px;margin:20px;border:1px solid #ef4444/30;'>"; | |
| echo "<h3 style='margin-top:0;'>⚠️ Imeshindwa Kupakia Stream (HTTP Status: {$res['code']})</h3>"; | |
| echo "<p style='color:#cbd5e1;'>Hakikisha link ya chaneli ipo hewani na package name <code>" . htmlspecialchars($packageName) . "</code> bado ipo hai (Active).</p>"; | |
| echo "</div>"; | |
| exit; | |
| } | |
| $html = $res['body']; | |
| // Route DRM calls kupitia faili hili ili kuepuka CORS issues | |
| $path = dirname($parsedOrigin['path'] ?? '/'); | |
| $baseHost = $baseOrigin . rtrim($path, '/'); | |
| $html = str_replace( | |
| "'license_proxy.php?url='", | |
| "'" . $scriptName . "?proxy_license=1&pkg=" . urlencode($packageName) . "&base=" . urlencode($baseHost) . "&license_url='", | |
| $html | |
| ); | |
| // Hakikisha token refresh inabeba package sahihi | |
| if ($packageName !== DEFAULT_PACKAGE) { | |
| $html = str_replace( | |
| "currentUrl.searchParams.set('ajax', '1');", | |
| "currentUrl.searchParams.set('ajax', '1');\ncurrentUrl.searchParams.set('pkg', " . json_encode($packageName) . ");", | |
| $html | |
| ); | |
| } | |
| // Toa Player kamili | |
| if ($res['mime']) header('Content-Type: ' . $res['mime']); | |
| echo $html; | |
Xet Storage Details
- Size:
- 5.75 kB
- Xet hash:
- 6e0ef896e909484376fd4ac077aa725a9e823bf10d653db75cb26e8916ceb1e4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.