Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find if video is syndicated on YouTube data api v3

I have a website with the ability for users to embed YouTube videos. Before letting the user do it our CMS checks if the video is embeddable and/or country restricted and sends a warning.

The check is done with a call to:

https://www.googleapis.com/youtube/v3/videos?id=[video_id]&key=[google_key]&part=snippet,contentDetails,statistics,status

Now we are developing an app and we found out that not all embeddable videos are allowed, but there seems to be another option called syndicate to have the permission to show a video outside of a webpage.

How can I check if the video has the syndicated flag when I know the id?

There is a flag you can add during a youtube search to only show embeddable or syndicated video on the Youtube v3 data api search videoEmbeddable and videoSyndicated.

Videos overview has a embeddable flag that I was using for the website I can't find any reference to the syndicate flag. I also can't find any other references other than a syndicate flag with an "allowed" value that seemed to exist in v2 but there are no references in v3 anymore.

like image 517
Kesty Avatar asked Jun 12 '17 15:06

Kesty


1 Answers

There are two concepts embeddable and syndicated. iOS devices use an iFrame so they basically embed. Android devices that use player API can check syndicated.

When you do a search->list, you can set videoEmbeddable and videoSyndicated to true.

Or if you are iterating through videos, for each video, you can do a video->list call with video id and check status.embeddable in the response.

Here is a blog post about this topic, even though examples are in v2, information is still relevant.

UPDATE

As per the comment by Kesty If you need to check the syndicate flag. You need to make request to /v3/search?q=[video_id] along with the flag and then another call to check the video details. It works because you can do a search with video id as q,

like image 139
Sahil Patel Avatar answered Oct 05 '22 11:10

Sahil Patel