Я пытаюсь сделать что-то вроде «Serial Downloader», чтобы импортировать все эпизоды всех сезонов из этого сайта в мою учетную запись openload, используя этот код:
<?php
error_reporting(0);
$serial = file_get_contents($_GET['serial']);
$doc = new DOMDocument();
$doc -> loadHTML($serial);
$xpath = new DOMXPath($doc);
$seasons = $xpath->query("//*[@class='vypisserial']")->item(0);
$serial_divs = $seasons->getElementsByTagName('div');
$x = 0;
foreach($serial_divs as $season){
$x++;
echo "Season ".$x."<br />";
$season_inner = $season->getElementsByTagName('div')->item(0);
if($season_inner->getAttribute('id')!==""){
echo "--- START OF SEASON ID '".$season_inner->getAttribute('id')."' ---<br />";
$season_div = $doc -> getElementByID($season_inner->getAttribute('id'));
$episode_links = $season_div->getElementsByTagName('a');
foreach ($episode_links as $episode_link_a) {
$episode_link = $episode_link_a -> getAttribute("href");
$c = file_get_contents("https://freeserial.sk".$episode_link);
$doc = new DOMDocument();
$doc -> loadHTML($c);
$frames = $doc -> getElementsByTagName('iframe');
$link = "https://freeserial.sk".($frames[0] -> getAttribute("src"));
$video = file_get_contents($link);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $link);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
echo "episode_link - ".$url."<br />";
$c = file_get_contents("https://api.openload.co/1/remotedl/add?login=3&key=C&url=".$url);
}
echo "--- END OF SEASON ID '".$season_inner->getAttribute('id')."' ---<br />";
} else {
echo "Nothing";
}
}
Когда я идув file.php? serial = https://www.freeserial.sk/serial/skam, Я вижу это ![file.php](https://i.stack.imgur.com/WZSrK.png)
Загружается только один сезон вместо четырех.Я понятия не имею, что не так.Я буду признателен за любую помощь.Спасибо