Youtube.net api - search inside a playlist

I get a 403 (forbidden) error when I try to search the Google playlist. If I remove .Query, it works fine. I know that the credentials work fine, since I use them in other places of the application without problems.

Am I mistaken about this, or is it impossible? I am using version 1.8.0.0 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); } 
+4
source share
2 answers

We worked on a somewhat similar problem: our client enters the YouTube request term in the “Application”, the results for the entire request are returned, and then the client selects the video to save in the db application. Then we can make the application splash out a custom playlist on the client site. Visitors to this site can then search for videos with a search query. We use Lucene.net to run queries on these custom Application Lists. With your situation, you could:

  • Request YouTube with a playlist ID.
  • Store or cache results (Url, title, length, etc.).
  • Complete the queries in this set with Lucene.

This is definitely more resources (storage, loops), and you may need to speed up working with the Lucene API, but I agree with Daniel that a quick and easy way (YouTube, which allows you to configure requests in playlists) will not work.

+2
source

Just sniffed an HTTP request that makes the code - you got a 403 error message because

This service does not support the q parameter.

It seems that the YouTube API does not support full-text search in a specific playlist. In fact, the YouTubeQuery.Query method simply adds a string to your base URI, something like this (you can take a look at the source of the FeedQuery and YouTubeQuery classes):

 url = baseUrl + string.Format("?q={0}", this.Query) 

So, with .Query your final URL is (if query = "life" ):

http://gdata.youtube.com/feeds/api/playlists/595A40209CB17411?q=life

+2
source

All Articles