I want to search for keyword related youtube videos, I'm using youtube getdata API.
Reading documentation I came up with this:
http://gdata.youtube.com/feeds/api/videos/-/". urlencode($kwd) ."?orderby=viewCount&max-results=". $max ."&alt=json
But this is not a real search, it gives urls taged with keyword... Youtubes internal search works quite differently I imagine, because comparing results don't match at all.
Any ideas?
Use Data API v3, search->list method.
The URL you offer does a search for any videos in a category where the category includes your keyword. What you want to do instead is to send a query string:
This way the feed will match right on the videos rather than the categories.
In the newer v3 of the API, your call would look like:
In my opinion, I would use the "q" parameter, for example to search for "dog"
var request = gapi.client.youtube.search.list({ part: 'snippet', q: "dog" });
But I'm just a noob the others guys answers are probably better.