<?php
$channel = isset($_GET['channel']) ? $_GET['channel'] : (isset($argv[1]) ? $argv[1] : null);
$clientId = $_SERVER['REMOTE_ADDR'];
if (!$channel || !$clientId) {
exit;
}
$macFile = "/volume1/stalker/89/89mac.txt";
$clientMacFile = "/volume1/stalker/89/client_macs.json";
$macAddresses = file($macFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if (!$macAddresses) {
exit;
}
if (!file_exists($clientMacFile)) {
file_put_contents($clientMacFile, json_encode([], JSON_PRETTY_PRINT));
}
$clientMacs = json_decode(file_get_contents($clientMacFile), true);
$usedMacs = array_values($clientMacs);
$availableMacs = array_diff($macAddresses, $usedMacs);
function generateRandomToken($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomToken = '';
for ($i = 0; $i < $length; $i++) {
$randomToken .= $characters[rand(0, $charactersLength - 1)];
}
return $randomToken;
}
$url = "http://89.45.13.220:8080";
if (substr($channel, -4) === '.mkv') {
$selectedMac = $availableMacs[array_rand($availableMacs)];
$token = generateRandomToken();
$constructedUrl = "$url/play/movie.php?mac=$selectedMac&stream=$channel&play_token=$token&type=movie";
header('Location: ' . $constructedUrl);
exit;
}
function isChannelAvailableForMac($mac, $channel) {
$macFolder = "/volume1/stalker/89/data/" . str_replace(':', '_', $mac);
$liveStreamsFile = "$macFolder/live_streams.txt";
if (!file_exists($liveStreamsFile)) {
return false;
}
$streams = file($liveStreamsFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
return in_array($channel, $streams);
}
function getStreamingLink($url, $channel, $selectedMac, $token) {
$encodedChannel = urlencode("http://localhost/ch/{$channel}_");
$opts = [
"http" => [
"header" => "User-Agent: Mozilla/5.0"
]
];
$context = stream_context_create($opts);
$response = @file_get_contents("$url/portal.php?type=itv&action=create_link&cmd=$encodedChannel&JsHttpRequest=1-xml&mac=$selectedMac&token=$token", false, $context);
$http_response_header = $http_response_header ?? [];
$error_codes = [401, 405, 456];
foreach ($http_response_header as $header) {
foreach ($error_codes as $code) {
if (strpos($header, (string)$code) !== false) {
return ['error' => true, 'streamingLink' => null];
}
}
}
if ($response !== false) {
$response = json_decode($response, true);
if (isset($response['js']['cmd'])) {
$urlPart = str_replace('\/', '/', $response['js']['cmd']);
$streamingLink = substr($urlPart, strpos($urlPart, 'http://'));
return ['error' => false, 'streamingLink' => $streamingLink];
}
}
return ['error' => true, 'streamingLink' => null];
}
$selectedMac = null;
$availableMacs = array_values($availableMacs);
shuffle($availableMacs);
foreach ($availableMacs as $mac) {
if (isChannelAvailableForMac($mac, $channel)) {
$selectedMac = $mac;
break;
}
}
if (!$selectedMac) {
exit;
}
$clientMacs[$clientId] = $selectedMac;
file_put_contents($clientMacFile, json_encode($clientMacs, JSON_PRETTY_PRINT));
$streamingLink = null;
$selectedMac = trim($selectedMac);
$response = @file_get_contents("$url/portal.php?type=stb&action=handshake&JsHttpRequest=1-xml&mac=$selectedMac");
if ($response !== false) {
$response = json_decode($response, true);
$token = $response['js']['token'] ?? null;
if ($token) {
do {
$result = getStreamingLink($url, $channel, $selectedMac, $token);
if (!$result['error']) {
$streamingLink = $result['streamingLink'];
} else {
unset($clientMacs[$clientId]);
file_put_contents($clientMacFile, json_encode($clientMacs, JSON_PRETTY_PRINT));
header('Location: ' . $_SERVER['PHP_SELF'] . '?channel=' . $channel);
exit;
}
$responseHeaders = @get_headers($streamingLink, 1);
} while (empty($responseHeaders['Location']) && !empty($availableMacs));
if (empty($responseHeaders['Location'])) {
unset($clientMacs[$clientId]);
file_put_contents($clientMacFile, json_encode($clientMacs, JSON_PRETTY_PRINT));
header('Location: ' . $_SERVER['PHP_SELF'] . '?channel=' . $channel);
exit;
}
}
}
if (!$streamingLink) {
unset($clientMacs[$clientId]);
file_put_contents($clientMacFile, json_encode($clientMacs, JSON_PRETTY_PRINT));
header('Location: ' . $_SERVER['PHP_SELF'] . '?channel=' . $channel);
exit;
}
header('Location: ' . $streamingLink);
?>
Ist das im Prinzip so, wie wenn ich bei einer m3u statt get Player_api schreibe?Wenn man dann noch mit der xtreamapi arbeitet,
Keine Ahnung warum ihr euch so aufregt.
ja richtig, das ist möglichIst das im Prinzip so, wie wenn ich bei einer m3u statt get Player_api schreibe?
zb
Sie müssen registriert sein, um Links zu sehen.Sie müssen registriert sein, um Links zu sehen.Also vergleich aktive Conns mit Max Conns.
Laienhaft ausgedrückt.
Ich habe den Proxy Manager auf meinem anderen Server da ich einige Apps (Sonarr, Radarr, Nextcloud uvm) laufen habe, welche von außen erreichbar sein müssen, die alle auf eine Sub-Domain umleiten und ich daher keinen Port 80 mehr auf meine Proxmox Instanz freigeben kann.für was brauchst denn den Nginx Proxy Manager unter Proxmox? gib den Port direkt auf die VM frei
nano /etc/apache2/ports.conf
Listen 8080 # eintragen
nano /etc/apache2/apache2.conf
Include ports.conf
<VirtualHost *:8080>
ServerName example.com
DocumentRoot /var/www/html/8080
CustomLog /var/log/apache2/access_log_8080 combined
ErrorLog /var/log/apache2/error_log_8080
</VirtualHost>
service apache2 restart
itv link : 192.168.1.185/optimus/live/test/test/live.m3u
xtream login: 192.168.1.185/optimus
user=test pw=test
Details for portal: optimus
host="192.168.1.185"
name="optimus"
live="optimus"
MAC="00:1A:xx:xx:xx:xx"
URL="http://optimus-tv.org:8080"
user="test"
pw="test"
itv link : 192.168.1.185/optimus/live/test/test/live.m3u
series link : 192.168.1.185/optimus/live/test/test/series.m3u
vod link : 192.168.1.185/optimus/live/test/test/vod.m3u
xtream login: 192.168.1.185/optimus
user=test pw=test
itv link : 192.168.1.185/optimus/live/test/test/live.m3u
xtream login: 192.168.1.185/optimus
user=test pw=test
http://192.168.1.185/var/www/html/optimus/live/test/test/192.168.1.185/optimus/itv.php?cmd=http://localhost/ch/489280_
lauft den die m3u unter /home/xtreammulti/optimus?
ls /home/xtreammulti/optimus
categoryliveselect categoryseriesselectids categoryvodselectids livecategory optimusmac.txt optimusvodmac.txt vodcategory
categoryseriesselect categoryvodselect itvphp.sh live.m3u optimusseriesmac.txt seriescategory
Wir verwenden Cookies und ähnliche Technologien für folgende Zwecke:
Akzeptieren Sie Cookies und diese Technologien?
Wir verwenden Cookies und ähnliche Technologien für folgende Zwecke:
Akzeptieren Sie Cookies und diese Technologien?