Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GlobalVariables.YoutubePlaylistId is defined like this:
- // public static string[] YoutubePlaylistId = {"---A-PLAYLIST-ID---", "---ANOTHER-PLAYLIST-ID---"};
- #region "Load Youtube Data"
- int i = 0;
- foreach (string playlistID in GlobalVariables.YoutubePlaylistId)
- {
- RestRequest YoutubeRequest = new RestRequest("/playlistItems?part=snippet&playlistId=" + playlistID + "&key=" + GlobalVariables.YoutubeClientID + "&maxResults=25", Method.GET);
- YoutubeRequest.RequestFormat = DataFormat.Json;
- GlobalVariables.YoutubeClient.ExecuteAsync<PlaylistObject>(YoutubeRequest, (YoutubeResponse) =>
- {
- PlaylistObject pl = YoutubeResponse.Data;
- NextPageToken[i] = pl.nextPageToken;
- foreach (Item v in pl.items)
- {
- if (v.snippet.title != "Private video")
- {
- AddVideo(v.snippet, i);
- }
- }
- i++;
- });
- }
- // This gives me a Object reference not set to an instance of an object. Have tried to find which object/line of code. Using RestSharp and RestSharpEx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement