I have a website that stores users playlists, but sometimes the videos that were once usable get removed due to copyright violations, or get deleted. I would like my website to automatically detect when this happens, so it can delete the video, or replace it. I'v done a lot of research trying to figure this out but nothing is working. for example, the api data request for the youtube video ID IcmTyiVkhGk (which is unavailable due to copyright) doesn't have a yt:state variable (which would indicate it is restricted), under access control, it does not say restricted or anything similar. How do you check for this type of data?
http://gdata.youtube.com/feeds/api/videos/IcmTyiVkhGk?v=2&prettyprint=true
basically using this to get the data, but no relevant data is there I don't think.
this site is able to detect what regions the site is available in: http://polsy.org.uk/stuff/ytrestrict.cgi?ytid=IcmTyiVkhGk Does anyone know how this works?
Use the v3 API. https://developers.google.com/youtube/v3/docs/videos/list
Your question is in 2 parts.
Example:
GET https://www.googleapis.com/youtube/v3/videos?part=id&id=abcdefghijklm&key={YOUR_API_KEY}
{
"kind": "youtube#videoListResponse",
"etag": "\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/qFRkUhSdCF83BrjXm7uub8slGsk\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": [
]
}
Example:
GET https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=IcmTyiVkhGk&key={YOUR_API_KEY}
Under items[] you'll check for
"regionRestriction": {
"blocked": [
"QA",
"AW",
"IN",
etc.
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With