added the evil script

This commit is contained in:
catSIXe 2020-10-12 00:30:19 +02:00
parent b5a9e9026f
commit 988dfa6cfb
5 changed files with 159 additions and 0 deletions

0
cache/.gitempty vendored Normal file
View file

25
channelsToM3U.php Normal file
View file

@ -0,0 +1,25 @@
<?php
include("config.php");
$channels=json_decode(file_get_contents("channels.json"), true);
//print_r($channels);
echo "#EXTM3U\n";
foreach($channels as $channel) {
echo "#EXTINF:-1,".$channel["name"]."\n";
//echo $channel["name"]."\n";
echo "http://$IP/?src=1";
echo "&msys=dvbs"; if ($channel["transponder"]["type"] == "DVB-S2") echo "2";
echo "&mtype=".strtolower($channel["transponder"]["modulation"]);
echo "&freq=".$channel["transponder"]["freq"].".00";
echo "&sr=".$channel["transponder"]["rate"];
echo "&pol=".strtolower($channel["transponder"]["pol"]);
echo "&fec=".preg_replace( '/[^0-9]/', '', $channel["transponder"]["fec"]);
$pids=array(0,16,17,18,20);
$pids=array_merge($pids, $channel["pids"]);
$pids=array_unique($pids);
asort($pids);
echo "&pids=".implode(',', $pids); //0,16,17,18,20,1760,1720,1760,5071";
echo "\n";
}
?>

15
config.php Normal file
View file

@ -0,0 +1,15 @@
<?
/*
Astra 19.2E https://www.satindex.de/transponderv-1.php
Astra 28.2E https://www.satindex.de/transponderv-3.php
... (and the other URLs from satindex.de
*/
$transponderDB = "https://www.satindex.de/transponderv-1.php";
/*
Elgato IP
*/
$IP = "192.168.1.1";
?>

115
fetchData.php Normal file
View file

@ -0,0 +1,115 @@
<?php
// by cat6e
$channels = array();
/*
Astra 19.2E https://www.satindex.de/transponderv-1.php
Astra 28.2E https://www.satindex.de/transponderv-3.php
... (and the other URLs from satindex.de
*/
$transponderDB = "https://www.satindex.de/transponderv-1.php";
function preg_first($re, $text) {
preg_match_all($re, $text, $matches, PREG_SET_ORDER, 0);
return $matches[0];
}
function getTransponders($url) {
$db = array();
$html=file_get_contents($url);
$html = trim(preg_replace('/\s\s+/', ' ', $html));
$html=substr($html, strpos($html, '</div><div class="freq_kopf" >'));
$html=substr($html, strpos($html, 'FEC</div>')+strlen('FEC</div>'));
$html=explode('"clear: both;"', $html);
unset($html[0]);
$re = '/<div class="tp_tab_a1" >(\s?\d+\.)<\/div> <div class="tp_tab_a2" >([0-9.]+)<\/div> <div.*><a.*>([0-9.]*)<\/a><\/div><div class="tp_tab_a1" >(H|V)<\/div> <div class="tp_tab_a2" >([0-9.]+)<\/div> <div class="tp_tab_a1" >(\d+\/\d+)<\/div> <div class="tp_tab_a2" >(DVB-S\d?)<\/div> <div class="tp_tab_a2" >([0-9A-Za-z]+)<\/div> <div class="tp_tab_a1" >([0-9.]*)<\/div> <div class="tp_tab_a3" ><img.*><\/div> <div class="tp_tab_a1" >(\d+)<\/div> <div class="tp_tab_a4" >(.*)<\/div>/im';
foreach($html as $transponder) {
$transponderM=preg_first($re, $transponder);
unset($transponderM[0]);
$transponder=array(
"transponder" => intval($transponderM[2]),
"tsid" => intval($transponderM[10]),
"freq" => intval($transponderM[3]),
"pol" => $transponderM[4],
"rate" => intval($transponderM[5]),
"fec" => $transponderM[6],
"type" => $transponderM[7],
"modulation" => $transponderM[8],
);
$db[intval($transponder["freq"])] = $transponder;
}
return $db;
}
function processChannel($channelLink) {
$pageLink = "https://www.satindex.de".$channelLink;
$pageCache = "cache/".urlencode(base64_encode($pageLink));
if (!file_exists($pageCache)) { file_put_contents($pageCache, file_get_contents($pageLink)); }
$html = file_get_contents($pageCache);
$pmtID = preg_first('/class="cell_l"\s+>PMT Pid:<\/div><div\s+class="cell_r"\s+>(\d+)<\/div>/m', $html)[1];
return array($pmtID);
}
function processTransponder($transponder) {
global $channels;
$pageLink = "https://www.satindex.de/frequenz/".$transponder["freq"];
$pageCache = "cache/".urlencode(base64_encode($pageLink));
if (!file_exists($pageCache)) { file_put_contents($pageCache, file_get_contents($pageLink)); }
$html = file_get_contents($pageCache);
$html = trim(preg_replace('/\s\s+/', ' ', $html));
$html = substr($html, strpos($html, '<div class="tvra"'));
$html = substr($html, 0, strpos($html, '"tp_info_end"'));
echo "Transponder:\t".$transponder["transponder"]."\n\n";
$html = explode('"clear: both;"', $html);
$re = '/<div class="freq_color_[01]" > <div class="col freqx_1" ><a href="(.*)" title=.*>(.*)<\/a><\/div> <div class="col freqx_2" ><img.*><\/div> <div class="col freqx_2" ><img .*><\/div> <div class="col freqx_2" ><img.*><\/div> <div class="col freqx_3" >(.*)<\/div> <div class="col freqx_4" >(\d*)<\/div> <div class="col freqx_4" >(.*)<\/div> <div class="col freqx_5" >(.*)<\/div> <div class="col freqx_4" >(.*)<\/div> <div class="col freqx_4" >(.*)<\/div> <div class="col2 freqx_6" >.*<\/div>/im';
unset($html[count($html) - 1]);
foreach($html as $channel) {
if (strpos("freq_color_", $channel) === false) {
$matchCount = preg_match_all($re, $channel, $channelM, PREG_SET_ORDER, 0);
if ($matchCount != 1) {
continue;
}
$channelM = $channelM[0];
unset($channelM[0]);
$pidsSlice = array_slice($channelM, 4);
$pids=array();
foreach($pidsSlice as $pid) {
if (intval($pid) != 0) {
if ((strpos("|", $pid) === false)) {
$multiKultiPIDs_xD = explode('|', $pid);
foreach($multiKultiPIDs_xD as $pidpid) {
array_push($pids, intval(preg_replace( '/[^0-9]/', '', $pidpid)));
}
} else {
array_push($pids, intval(preg_replace( '/[^0-9]/', '', $pid)));
}
}
}
$pids=array_merge($pids, processChannel($channelM[1]));
$channel=array(
"link" => $channelM[1],
"name" => $channelM[2],
"kategorie" => $channelM[3],
"transponder" => $transponder,
"pids" => $pids,
);
print_r($channel);
array_push($channels, $channel);
}
}
}
$transponder = getTransponders($transponderDB);
foreach($transponder as $t) {
processTransponder($t);
}
file_put_contents("channels.json", json_encode($channels));
?>

4
run.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/sh
php -f fetchData.php
php channelsToM3U.php > playlist.m3u8
echo "done, furk the payware"