public object Any(Search request) { /// var results = new List <Comment>(); Skybrud.Social.Instagram.InstagramService service = Skybrud.Social.Instagram.InstagramService.CreateFromOAuthClient(new InstagramOAuthClient { AccessToken = "281166601.ae390ad.f16a68e5d161400a88f124dd07690b36" }); // Temporary list for storing the retrieved media List <InstagramMedia> temp = new List <InstagramMedia>(); // Declare the initial options InstagramTagRecentMediaOptions options = new InstagramTagRecentMediaOptions { Count = 10 }; // Make the call to the API for the first page InstagramRecentMediaResponse response = service.Tags.GetRecentMedia(request.Keyword, 200); InstagramSearchTagsResponse response2 = service.Tags.Search(request.Keyword); // Add the media to the list temp.AddRange(response.Body.Data); // No reason to make another request if the first request didn't return any media if (temp.Count != 0) { // Update the options options.MaxTagId = response.Body.Pagination.NextMaxId; // Make another call to the Instagram API response = service.Tags.GetRecentMedia("allblacks", 200, options.MaxTagId); // Add the media to the list temp.AddRange(response.Body.Data); } foreach (InstagramMedia media in temp) { results.Add(new Comment { Description = media.CaptionText, Provider = "Instagram" }); } foreach (InstagramTag tag in response2.Body.Data) { results.Add(new Comment { Description = tag.Name, Provider = "Instagram" }); } return(results); }
/// <summary> /// Gets the raw JSON response from the Instagram API with media from the specified <code>tag</code>. /// </summary> /// <param name="tag">The name of the tag.</param> /// <param name="options">The options for the call to the API.</param> public SocialHttpResponse GetRecentMedia(string tag, InstagramTagRecentMediaOptions options) { return(Client.DoAuthenticatedGetRequest("https://api.instagram.com/v1/tags/" + tag + "/media/recent/", options)); }