Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Use the YouTube API to check if a video is embeddable

$
0
0

I'm trying to figure out if a YouTube video is embeddable using the YouTube Data API v3, from answers to similar questions I noticed the status.embeddable property of videos, for a request like this:

https://www.googleapis.com/youtube/v3/videos?id=63flkf3S1bE&part=contentDetails,status&key={MY_API_KEY}

The response is the following

{"kind": "youtube#videoListResponse","etag": "\"ksCrgYQhtFrXgbHAhi9Fo5t0C2I/ctZQYtBcOuMdnQXh8-Fv1EbS_VA\"","pageInfo": {"totalResults": 1,"resultsPerPage": 1    },"items": [        {"kind": "youtube#video","etag": "\"ksCrgYQhtFrXgbHAhi9Fo5t0C2I/Cd8aGZD09NPuGYNumIEozZs2S90\"","id": "63flkf3S1bE","contentDetails": {"duration": "PT8M23S","dimension": "2d","definition": "hd","caption": "false","licensedContent": false,"projection": "rectangular"            },"status": {"uploadStatus": "processed","privacyStatus": "public","license": "youtube","embeddable": true,"publicStatsViewable": true,"madeForKids": false            }        }    ]}

The embeddable parameter under status is returned as true, HOWEVER this video is not actually embeddable, as can be seen here.

When actually embedding the video using the iframe API, there is a more detailed error message as well:

Video unavailable This video contains content from International Olympic Committee, who has blocked it from display on this website or application. Watch on YouTube

I don't see how it is possible to detect this case from the YouTube Data API - can anyone help out?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>