Checking validity of YouTube video with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
defroster
Forum Commoner
Posts: 49
Joined: Wed Mar 24, 2010 12:05 pm

Checking validity of YouTube video with php

Post by defroster »

Hello,

I embed some YouTube videos on my site. Sometimes a video is deleted from YouTube and I have no way of knowing. Does anyone know if there is some php script or by using their API you can check if a video has:

- video has been removed
- video is not embeddable any more

any ideas? Thanks
/df
defroster
Forum Commoner
Posts: 49
Joined: Wed Mar 24, 2010 12:05 pm

Re: Checking validity of YouTube video with php

Post by defroster »

I see if I use this I can get a lot of information from the video but not if it is embeddable or not.
http://gdata.youtube.com/feeds/api/videos/i9gucBfZ1qg

and if a video is invalid and I use the link above I get a page that says
'Video not found'

- How could I use this information to loop through a set of links (from own database) and it would tell me if it is valid or not?
- Any ideas how to check also if it is embeddable?

Thanks
Post Reply