How do I check a youtube link for the existence of a video?
Tell me who knows. How do I check a youtube link for the existence of a video?
1
2 answers
Get the video ID from the url and make a request to the API
Https://gdata.youtube.com/feeds/api/videos/0OSNouPNAm1?v=2
If the video does not exist, the response will be
<errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>ResourceNotFoundException</code><internalReason>Video not found</internalReason></error></errors>
You can also access the video preview with its ID
Http://img.youtube.com/vi/0OSNouPNAm1/1.jpg
If the video does not exist, the response will be with the code 404
2
Author: LinnTroll, 2014-03-21 07:11:57
Well, as an option, parse the page or look at the response number from the server.
0
Author: progmb, 2014-03-20 20:17:20