theDazzler
theDazzler

Reputation: 1059

Youtube Data API Video Embed Restrictions

I am using the youtube data api to search for youtube videos and it is working fine except for the fact that restricted videos show up in the results(in particular, music videos from vevo). I only want videos to show up in the results that are able to be embedded or placed inside an iframe. Here is an example search query for "eminem" where the top result that shows up is restricted.

"http://gdata.youtube.com/feeds/api/videos?q=eminem&format=5&max-results=10&v=2&alt=jsonc"

If you paste that query here, you can see the JSON results from the query.

I tried "format=5" as you can see and I looked at "restriction" and "status" as well in the API, but haven't gotten anything to work yet.

Does anyone know how to ONLY display videos in the search results that can be embedded or placed inside an iframe? I don't want restricted videos showing up.

Upvotes: 2

Views: 1748

Answers (1)

Michal
Michal

Reputation: 3368

You should look into the safeSearch here http://code.google.com/intl/sk-SK/apis/youtube/2.0/reference.html#safeSearchsp. They say it's designed to work as you expect, however, I have made a short test and it doesn't.

However, there is another way into this. You could use the fields argument described here http://code.google.com/intl/sk-SK/apis/youtube/2.0/reference.html#Projection_Values. However, in my tests it had a problem with the JSONC output format for some reason.

There may be another way to filter the results with partial response described here http://code.google.com/intl/sk-SK/apis/youtube/2.0/developers_guide_protocol_partial.html.

Upvotes: 1

Related Questions