Spaces:
Paused
Paused
Delete all.php
Browse files
all.php
DELETED
|
@@ -1,101 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* all.php — JAYNES MAX TV (v3.2-split)
|
| 4 |
-
* Inapiga part1.php...part5.php MOJA BAADA YA NYINGINE (sequential,
|
| 5 |
-
* bila curl_multi) — hii ni salama zaidi kwa hosting za bure kama
|
| 6 |
-
* InfinityFree ambazo zinapunguza/kuzuia simultaneous connections.
|
| 7 |
-
*
|
| 8 |
-
* ONYO: kwa sababu ni sequential, muda jumla ni takriban jumla ya
|
| 9 |
-
* muda wa part5 zote (mf. sekunde ~18 kila moja × 5 = ~90s).
|
| 10 |
-
* Kama InfinityFree ina hard time-limit chini ya hapo (kawaida
|
| 11 |
-
* sekunde 20-30), ombi hili LINAWEZA kupata 500 pia. Ukiona hilo,
|
| 12 |
-
* suluhisho bora zaidi ni frontend (JavaScript) ipige part1..part5
|
| 13 |
-
* KWA PAMOJA (fetch() x5 kwa wakati mmoja kutoka browser), si server
|
| 14 |
-
* hii — kwa sababu browser haiathiriwi na kikomo cha connections cha
|
| 15 |
-
* hosting yako. Niambie ukihitaji msaada wa hiyo.
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
header('Content-Type: application/json; charset=UTF-8');
|
| 19 |
-
header('Access-Control-Allow-Origin: *');
|
| 20 |
-
header('Access-Control-Allow-Methods: GET, OPTIONS');
|
| 21 |
-
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { http_response_code(204); exit; }
|
| 22 |
-
|
| 23 |
-
@ini_set('display_errors', '0');
|
| 24 |
-
error_reporting(E_ERROR);
|
| 25 |
-
|
| 26 |
-
while (ob_get_level() > 0) { ob_end_flush(); }
|
| 27 |
-
ob_implicit_flush(true);
|
| 28 |
-
ignore_user_abort(true);
|
| 29 |
-
|
| 30 |
-
require __DIR__ . '/kraudius_core.php';
|
| 31 |
-
|
| 32 |
-
$t0 = microtime(true);
|
| 33 |
-
$source = trim($_GET['source'] ?? 'kraudius');
|
| 34 |
-
|
| 35 |
-
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
| 36 |
-
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
| 37 |
-
$dir = rtrim(str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'] ?? '')), '/');
|
| 38 |
-
$baseUrl = "{$scheme}://{$host}{$dir}";
|
| 39 |
-
|
| 40 |
-
$partFiles = ['part1.php', 'part2.php', 'part3.php', 'part4.php', 'part5.php'];
|
| 41 |
-
|
| 42 |
-
$channels = [];
|
| 43 |
-
$okCount = 0;
|
| 44 |
-
$failCount = 0;
|
| 45 |
-
$fb1Count = 0;
|
| 46 |
-
$dupCount = 0;
|
| 47 |
-
$partsDebug = [];
|
| 48 |
-
$partsFailed = [];
|
| 49 |
-
|
| 50 |
-
foreach ($partFiles as $f) {
|
| 51 |
-
$url = $baseUrl . '/' . $f . '?source=' . urlencode($source);
|
| 52 |
-
|
| 53 |
-
$tPart = microtime(true);
|
| 54 |
-
$result = fetchPage($url);
|
| 55 |
-
$partMs = (int)((microtime(true) - $tPart) * 1000);
|
| 56 |
-
|
| 57 |
-
$decoded = $result['html'] ? json_decode($result['html'], true) : null;
|
| 58 |
-
|
| 59 |
-
if (!$decoded || empty($decoded['success'])) {
|
| 60 |
-
$partsFailed[] = $f;
|
| 61 |
-
$partsDebug[$f] = [
|
| 62 |
-
'ok' => false,
|
| 63 |
-
'code' => $result['code'],
|
| 64 |
-
'ms' => $partMs,
|
| 65 |
-
'error' => $result['error'] ?: 'Invalid/empty response',
|
| 66 |
-
];
|
| 67 |
-
continue;
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
$channels = array_merge($channels, $decoded['channels'] ?? []);
|
| 71 |
-
$okCount += $decoded['ok_count'] ?? 0;
|
| 72 |
-
$failCount += $decoded['fail_count'] ?? 0;
|
| 73 |
-
$fb1Count += $decoded['with_fallback1'] ?? 0;
|
| 74 |
-
$dupCount += $decoded['same_url_count'] ?? 0;
|
| 75 |
-
|
| 76 |
-
$partsDebug[$f] = [
|
| 77 |
-
'ok' => true,
|
| 78 |
-
'range' => $decoded['range'] ?? '',
|
| 79 |
-
'part_ms' => $partMs,
|
| 80 |
-
'elapsed_ms' => $decoded['elapsed_ms'] ?? null,
|
| 81 |
-
];
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
usort($channels, fn($a, $b) => ($a['channel'] ?? 0) <=> ($b['channel'] ?? 0));
|
| 85 |
-
|
| 86 |
-
echo json_encode([
|
| 87 |
-
'success' => empty($partsFailed),
|
| 88 |
-
'version' => 'v3.2-split',
|
| 89 |
-
'source' => $source === 'all' ? 'KraudiusTV + LiveBlog365' : sourceLabel($source),
|
| 90 |
-
'range' => '1-52',
|
| 91 |
-
'total' => count($channels),
|
| 92 |
-
'ok_count' => $okCount,
|
| 93 |
-
'fail_count' => $failCount,
|
| 94 |
-
'with_fallback1' => $fb1Count,
|
| 95 |
-
'same_url_count' => $dupCount,
|
| 96 |
-
'parts_failed' => $partsFailed,
|
| 97 |
-
'fetched_at' => date('Y-m-d H:i:s'),
|
| 98 |
-
'elapsed_ms' => (int)((microtime(true) - $t0) * 1000),
|
| 99 |
-
'parts_debug' => $partsDebug,
|
| 100 |
-
'channels' => $channels,
|
| 101 |
-
], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|