How to check if a YouTube video is blocked / disabled / deleted?

I have a website that stores user playlists, but sometimes the videos that were once used are deleted due to copyright infringement or deleted. I would like my site to automatically detect when this happens, so it can delete the video or replace it. I did a lot of research trying to figure it out, but nothing works. for example, requesting api data for a youtube YouTube video identifier IcmTyiVkhGk (which is not available due to copyright) does not have the yt: state variable (which indicates that it is restricted), under access control, it does not say that it is restricted or something still similar. How do you check this type of data?

http://gdata.youtube.com/feeds/api/videos/IcmTyiVkhGk?v=2&prettyprint=true

basically using this to get data, but I don't think of any relevant data.

this site is able to detect in which regions the site is available: http://polsy.org.uk/stuff/ytrestrict.cgi?ytid=IcmTyiVkhGk Does anyone know how this works?

+10
source share
2 answers

Use API v3.   https://developers.google.com/youtube/v3/docs/videos/list

Your question is listed in 2 parts.

  • , YouTube, : . , totalResults 0. , , , - YouTube.

:

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": [
 ]
}
  1. , : .

:

GET https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=IcmTyiVkhGk&key={YOUR_API_KEY}

[]

 "regionRestriction": {
 "blocked": [
  "QA",
  "AW",
  "IN",
  etc.
  ]
  }
+9

, . PHP- youtube , , "". 1,1 . , , DDOS-.

.

0

All Articles