0

我的视频列表太大了。我每周对其进行检查以确保视频没有死,现在脚本在一段时间后在浏览器中停止。我运行一个专用服务器,但我不想增加我的执行时间。我希望它在一页上显示所有结果,因为我将它设置为滚动到页面底部。(矩阵样式)

我只是想在正确的方向上获得一些指导。

<?
// Includes
include('db.php');
// Variables
$liveTotal = 0;
$deadTotal = 0;
// Query
$sql = "SELECT * FROM videos WHERE youtube <> '' ORDER BY id DESC";
$deadvideo = mysqli_query ($conn, $sql);
// Flush Buffer
ob_implicit_flush(true);
ob_end_flush();
while ($row = mysqli_fetch_assoc($deadvideo))
    {
        $video_url = @file_get_contents('https://www.youtube.com/oembed?format=json&url=http://www.youtube.com/watch?v=' . $row["youtube"]);
        if(!$video_url)
        {
            // The code below will print all of the dead videos directly to your screen if uploaded in a public directory
            $dead = '<font color="red"><strong>Dead video</strong></font> <a href="https://www.youtube.com/watch?v=' . $row["youtube"] . '">' . $row["title"] . '</a>';
            echo $dead . '<br>';
            $deadTotal++;
        }
        else
        {
            // The code below will print all of the live videos directly to your screen if uploaded in a public directory
            $live = '<font color="darkgreen"><strong>Live video</strong></font> <a href="https://www.youtube.com/watch?v=' . $row["youtube"] . '">' . $row["title"] . '</a>';
            echo $live . '<br>';
            $liveTotal++;
        }
    };
    echo '<br>' . '<strong>Scan Finished</strong>' . '<br>';
    $total = $liveTotal+$deadTotal;
    echo '<br>' . '<strong>Total Videos' . ': ' . $total;
    echo '<br>' . '<strong><font color="darkgreen">Live Videos' . ': ' . $liveTotal . '</font>';
    echo '<br>' . '<strong><font color="red">Dead Videos' . ': ' . $deadTotal . '</font>';
?>
4

0 回答 0