I’m getting a 403 (forbidden) error when I try to search inside a google playlist. If I remove the .Query it works fine. I know the credentials work fine as I’m using them in other places in the application without a problem.
Am I going about this this wrong way, or is this not possible? I’m using version 1.8.0.0 of the api (new download).
void SearchPlaylistVideos(string playListId, string query)
{
YouTubeQuery videoQuery = new YouTubeQuery(String.Format("http://gdata.youtube.com/feeds/api/playlists/{0}", playListId));
videoQuery.Query = query;
Feed<Video> feed = CreateAuthenticatedRequest().Get<Video>(videoQuery);
foreach (Video entry in feed.Entries) {
//Response.Write("<br />" + entry.Title);
}
}
YouTubeRequest CreateAuthenticatedRequest()
{
YouTubeRequestSettings settings = new YouTubeRequestSettings
(
ConfigurationManager.AppSettings["GData.AppName"],
ConfigurationManager.AppSettings["GData.DeveloperKey"],
ConfigurationManager.AppSettings["GData.Email"],
ConfigurationManager.AppSettings["GData.Password"]
);
settings.Timeout = 1000000;
return new YouTubeRequest(settings);
}
We’ve worked on a somewhat similar problem: Our client enters a YouTube query term into “The App”, results for the entire query are returned, and then the client picks videos to persist to the App’s db. We can then have the app spit out a custom playlist to the client’s site. Visitors to this site can then search for videos with a search term. We use Lucene.net to run queries on these custom “App” lists. With your situation, could you:
It’s definitely more resource (storage, cycles) intensive, and you may need to get up to speed with Lucene’s API, but I concur with Данаил that the quick and easy way (YouTube allowing custom queries on playlists) won’t work.