How to unlist/disable (not delete) deleted youtube videos on playtube script automaticaly

in php •  6 years ago 

Open file "index.php" in root directory of site
find this code:

$og_meta = '';
if ($pt->page == 'watch') {
$og_meta = PT_LoadPage('watch/og-meta', array(
'TITLE' => $pt->title,
'DESC' => mb_substr($pt->description, 0, 400, "UTF-8"),
'THUMB' => str_replace('mqdefault', 'maxresdefault', $get_video->thumbnail),
'URL' => PT_Link('watch/' . PT_Slug($get_video->title, $get_video->video_id))
));

and modify it to:

$og_meta = '';
if ($pt->page == 'watch') {
$og_meta = PT_LoadPage('watch/og-meta', array(
'TITLE' => $pt->title,
'DESC' => mb_substr($pt->description, 0, 400, "UTF-8"),
'THUMB' => str_replace('mqdefault', 'maxresdefault', $get_video->thumbnail),
'URL' => PT_Link('watch/' . PT_Slug($get_video->title, $get_video->video_id))
));

$YtbVidId = $get_video->youtube;
$SiteVidID = $get_video->id;
$GetVideoInfo = file_get_contents("https://www.youtube.com/get_video_info?video_id=$YtbVidId");
if (preg_match('/\berrorcode\b/',$GetVideoInfo)) {
        $con = @mysqli_connect('localhost', $sql_db_user, $sql_db_pass, $sql_db_name);
        if (!$con) {
            echo "Error: " . mysqli_connect_error();
            exit();
        }
        mysqli_set_charset($con,"utf8");
                mysqli_query($con,"UPDATE `videos` SET `privacy` = '2' WHERE `id` = '$SiteVidID'")
                or 
                die(mysqli_error($db));
        mysqli_close($con);
}

}

Next time when you or user/bot open page with broken video its will be set to unlisted on site

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hello @bolenot! This is a friendly reminder that you have 3000 Partiko Points unclaimed in your Partiko account!

Partiko is a fast and beautiful mobile app for Steem, and it’s the most popular Steem mobile app out there! Download Partiko using the link below and login using SteemConnect to claim your 3000 Partiko points! You can easily convert them into Steem token!

https://partiko.app/referral/partiko

Thank you, im enjoyed to partiko!

  ·  6 years ago Reveal Comment