YouTube Dead Video ...
 
Notifications
Clear all

YouTube Dead Video Detector For PlayTube  

Page 1 / 3
  RSS

Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
October 28, 2018 7:24 am  

Note: Always backup your db and any files to be modified just to be safe. These types of modifications are not a simple plug and play kind of install. I am not responsible for any loss of data nor does this script come with any guarantee. This script is provided as is.

This is a minor update to my PlayTube Video Cleanup modification for PlayTube. This script will check YouTube against your PlayTube YouTube videos to make sure no YouTube videos are dead, invalid, deleted, or private. The first we will talk about is the cron job version which is automated, the second version is the web view version which lets you see the results real time, but I have chosen to not update it due to popularity of automating the process. It works just as well, just requires a couple additional steps. If requested, I can update it as well.

 

Cron Job Installation

Features

  • Auto delete dead videos
  • Plug and play
  • Send email with a list of all the dead videos with the corresponding links
  • Verifies YouTube services are online to prevent unintended deletion
  • Send an email if connection to YouTube services fails
  • Checks in place to only send an email if dead videos are detected

 

FAQ

Q: Will this cause me to exceed my YouTube API call limit?
A: This does not call YouTube's API, therefor there are no limitations of this script.

Q: I get fatal error, max_execution time exceeds 30 seconds.
A: Be sure to set your php settings to PlayTube recommendations via .htaccess or php.ini file. Also if you run the normal version it can use memory more, try to get your host to enable curl and use the Optimized version.

file_uploads = On
post_max_size = 2024M
upload_max_filesize = 2024M
output_buffering = Off
max_execution_time = 4000
max_input_vars = 3000
max_input_time = 5000
memory_limit = 400M
zlib.output_compression = Off

I have included multiple versions to try and suit everyone's needs. There is a version that doesn't delete videos and will only send you emails of dead videos and failures. Navigate the folders to find which version you want to use.

Try Optimized first, if this doesn't work, your server may not support curl and you will need to use the Normal version.

This will be a different install path. You need to one directory before your public_html.

Then go to cPanel -> Cron

Setup a command with the following

php -q -f /home/CPANELUSERNAME/video-maintenance.php

If you for some reason do not know your cPanel username I have added in info.php. Simply add this file to your public_html and go to yourdomain.com/info.php

Search for DOCUMENT_ROOT

For the rest of the cron config
Minute: 0
Hour: 3
Day: *
Month: *
Weekday: *

This will run everyday at 3AM server time.

 

Changelog

v1.0

  • Release
 
 
Web View Installation
 

Use curl if your server has it enabled, otherwise use normal. You can then point your browser to the option you decided to go with. I recommend renaming the file detect.php or detect-curl.php to something the public won't guess, but leave the .php at the end of the file. Upon loading the file it will start spitting out all your live videos and ones that are dead will show Dead Video. Once the script completes, it will tell you how many videos are dead. If you have dead videos, press Ctrl + F to search the page for Dead Video. If you only want your page to show the dead videos, you can modify the code of detect.php or detect-curl.php like so:

Find and Remove

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="' . $site_url . '/watch/' . $row["video_id"] . '" target="_blank">' . $row["title"] . '</a>';
echo $dead . ' - Row ID (' . $row["id"] . ')<br>';
$liveTotal++;
}

 

Now it will only pass dead videos to your page.

Note: If doing it this way, your page will look frozen, this is because it is no longer printing the video titles to the screen. Wait until it's finished and it will tell you if any videos were dead.

 

FAQ

Q: I get fatal error, max_execution time exceeds 30 seconds.
A: Be sure to set your php settings to PlayTube recommendations via .htaccess or php.ini file

file_uploads = On
post_max_size = 2024M
upload_max_filesize = 2024M
output_buffering = Off
max_execution_time = 4000
max_input_vars = 3000
max_input_time = 5000
memory_limit = 400M
zlib.output_compression = Off

 

Q: I still get fatal error, max_execution time exceeds 30 seconds.
A: Your database may have too many videos. Mine currently has over 10,000 and does not have this issue, but I am currently developing an update to both this and the cron job version, which will queue up the queries.

 

Q: Is there anyway to fix it quickly while you work on this functionality?
A: Yes, find

$sql = "SELECT * FROM videos WHERE youtube <> '' ORDER BY id ASC";

Replace with

$sql = "SELECT * FROM videos WHERE youtube <> '' ORDER BY id ASC LIMIT 5000";

After your first run change the above to

$sql = "SELECT * FROM videos WHERE youtube <> '' AND id > 5000 ORDER BY id ASC LIMIT 5000";

After that run change it to

$sql = "SELECT * FROM videos WHERE youtube <> '' AND id > 10000 ORDER BY id ASC LIMIT 5000";

and so on

Of course this is a quick and dirty way to do this, and will take longer, plus if you don't have an id of 5000 or whichever number you will be calling, it will error out. ( For example you deleted the video with id 5000 )

 

Q: It lists videos from oldest to newest. How can I change this?
A: Pretty easily, just find the following

SELECT * FROM videos WHERE youtube <> '' ORDER BY id ASC

Replace ASC to DESC

 

 

Coming Soon

  • Integration with PlayTube ( Admin Only Access )
  • Simple options panel to select curl or normal, email dead videos, save to text file, or delete dead videos on completion.
  • Store dead videos in array to send an email of all dead videos
  • Delete dead videos
  • Store dead videos in text file
  • Build cron version back out using curl for optimization.

 

Changelog

v1.1

  • Now has two versions, one curl, and one normal file_get_contents. ( not as fast or optimized as curl, but some servers do not allow curl )
  • Video links to actual PlayTube installation making it quicker to find the video and delete it.
  • Changed order to be ASC to check oldest videos first. Since these are most likely to be dead.
  • Added row ID to make easier to see where video is in db.
  • Page stays at the bottom to see latest results.
  • Displays live and dead video titles.
  • At end of script will display total video, total live, and total dead video counts.

 

v1.0

  • Release
This topic was modified 2 years ago 37 times by Disquy

Quote
vntube
(@vntube)
Trusted Member
Joined: 2 years ago
Posts: 66
October 28, 2018 9:34 am  

does not work, it is a blank page

https://vntube.fun/xoavideo

This post was modified 2 years ago by Disquy

ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
October 28, 2018 2:16 pm  
Posted by: vntube

does not work, it is a blank page

https://vntube.fun/xoavideo

You have to retain the file as the .php extension. Rename xoavideo to xoavideo.php

 

Also if it still doesn't work, make sure curl is enabled on your server. I just added a new version which includes a non curl version if you do not have this enabled on your server. Curl will be faster and is better optimized to handle the large amount of requests, but if you have a shared server and they won't allow curl, then the normal version should work fine. Download the new version 1.1 here.

Changelog
v1.1

  • Now has two versions, one curl, and one normal file_get_contents. ( not as fast or optimized as curl, but some servers do not allow curl )
  • Video links to actual PlayTube installation making it quicker to find the video and delete it.
  • Changed order to be ASC to check oldest videos first. Since these are most likely to be dead.
  • Added row ID to make easier to see where video is in db.
  • Page stays at the bottom to see latest results.
  • Displays live and dead video titles.
  • At end of script will display total video, total live, and total dead video counts.

 

Coming Soon

  • Integration with PlayTube ( Admin Only Access )
  • Simple options panel to select curl or normal, email dead videos, save to text file, or delete dead videos on completion.
  • Store dead videos in array to send an email of all dead videos
  • Delete dead videos
  • Store dead videos in text file
  • Build cron version back out using curl for optimization.
This post was modified 2 years ago 8 times by Disquy

ReplyQuote
vntube
(@vntube)
Trusted Member
Joined: 2 years ago
Posts: 66
October 28, 2018 6:23 pm  

thank you, maybe because i'm running on version 1.4.5.1 it does not work


ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
October 28, 2018 8:04 pm  
Posted by: vntube

thank you, maybe because i'm running on version 1.4.5.1 it does not work

I realize the forum software I am using had an issue and did not attach the files. Try these files, they will work properly. Also make sure you are putting your database details in db.php.

https://disquy.com/wp-content/uploads/wpforo/default_attachments/1540758894-youtube-video-status-v1.1.zip


ReplyQuote
vntube
(@vntube)
Trusted Member
Joined: 2 years ago
Posts: 66
November 7, 2018 5:23 am  

After I changed the hosting, it ran ok. thank you. Is there any way to automatically remove dead video?


ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
November 8, 2018 12:08 am  

Yes, but I would click one of the dead video links first, just to confirm it is dead. After verification proceed to the following steps.

Find in detect.php or detect-curl.php
$deadTotal++;

Below Add
$delete = "DELETE FROM videos WHERE id=" . $row["id"];
mysqli_query($conn, $delete);

This post was modified 2 years ago by Disquy

ReplyQuote
vntube
(@vntube)
Trusted Member
Joined: 2 years ago
Posts: 66
November 8, 2018 12:15 am  

Many thanks, I will try to do it


ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
November 8, 2018 12:23 am  
Posted by: vntube

Many thanks, I will try to do it

You're welcome. 🙂


ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
November 10, 2018 12:31 am  

v1.2

  • Added YouTube API checks to verify the API is live before running script, otherwise if it went down all videos would show offline and flagged as dead.
  • Added version inside of package which has auto deletion of videos.

 

Upgrade Instructions

Backup your database

In order to upgrade, please delete previous versions of the modification.

Download new version here.

Open the zip file and choose your version. If you want the script to automatically delete dead videos open the "Deletes Dead Videos" folder, otherwise open the "Does Not Delete Dead Videos" folder

If your server supports cURL open the folder named "Optimized" otherwise open the "Normal" folder.

Upload the contents of the "upload" folder to your PlayTube installation.

Visit yourdomain.com/status/detect.php

* I recommend renaming detect.php to something the public won't guess. Make sure to retain the .php extension.

This post was modified 2 years ago 3 times by Disquy

ReplyQuote
vntube
(@vntube)
Trusted Member
Joined: 2 years ago
Posts: 66
November 10, 2018 12:50 am  

it works well, thank you very much, you have free support with all your heart. thank you  😊  😊  😊  😊 


ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
November 10, 2018 12:53 am  
Posted by: vntube

it works well, thank you very much, you have free support with all your heart. thank you  😊  😊  😊  😊 

You're welcome, happy to help. 🙂

More Features Coming Soon

  • Integration with PlayTube ( Admin Only Access )
  • Simple options panel to select curl or normal, email dead videos, save to text file, or delete dead videos on completion
  • Store dead videos in array to send an email of all dead videos
  • Store dead videos in text file
  • Build cron version

ReplyQuote
vntube
(@vntube)
Trusted Member
Joined: 2 years ago
Posts: 66
November 10, 2018 12:57 am  
Does your post auto facebook work? I used auto post facebook and was locked 1 domain haha
This post was modified 2 years ago by Disquy

ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
November 10, 2018 1:15 am  

It does, but you have to have a business license. The new API version they released won't give you the permissions you need until you verify your business. I use it on vigeos.net at the moment, but once they depreciate the API version I am using, I won't be giving them any business info to keep things going.

This post was modified 2 years ago 2 times by Disquy

ReplyQuote
Disquy
(@disquy)
Member Admin
Joined: 3 years ago
Posts: 88
December 18, 2018 9:38 am  

YouTube Dead Video Detector Cron Job For PlayTube is now available for download, see original post for details

Features

  • Auto delete dead videos
  • Plug and play
  • Send email with a list of all the dead videos with the corresponding links
  • Verifies YouTube services are online to prevent unintended deletion
  • Send an email if connection to YouTube services fails

ReplyQuote
Page 1 / 3
Share: