google api - Incompatibility windows form application -
i want make program search videos on youtube using youtube data api, v3, have key , access , im using vb.net in windows form in visual studio 2013 , dont found example in console doesn't help.
example:http://pastebin.com/k5liynje , http://pastebin.com/getkfia6
help
the youtube data api lets request set of videos match particular search term. api supports variety of standard google data query parameters , custom parameters related video search.
to execute search request, create youtubequery object specifies search criteria , pass object youtuberequest.get() method.
in client library code, query class , subclasses youtubequery responsible constructing feed urls. youtubequery object in example above constructs following feed url:
here's sample code snippet uses .net platform:
var searchlistrequest = youtubeservice.search.list("snippet"); searchlistrequest.q = "google"; // replace search term. searchlistrequest.maxresults = 50; // call search.list method retrieve results matching specified query term. var searchlistresponse = await searchlistrequest.executeasync(); list<string> videos = new list<string>(); list<string> channels = new list<string>(); list<string> playlists = new list<string>(); // add each result appropriate list, , display lists of // matching videos, channels, , playlists. foreach (var searchresult in searchlistresponse.items) { switch (searchresult.id.kind) { case "youtube#video": videos.add(string.format("{0} ({1})", searchresult.snippet.title, searchresult.id.videoid)); break; case "youtube#channel": channels.add(string.format("{0} ({1})", searchresult.snippet.title, searchresult.id.channelid)); break; case "youtube#playlist": playlists.add(string.format("{0} ({1})", searchresult.snippet.title, searchresult.id.playlistid)); break; } }
for complete code on how retrieve search result, check this: https://developers.google.com/youtube/v3/code_samples/dotnet#search_by_keyword
Comments
Post a Comment