public async void UploadWithOptions() { // You can add hashtags or locations or poll questions to your photo/video stories! // Note that you must draw your hashtags/location names/poll questions in your image first and then upload it! var storyOptions = new InstaStoryUploadOptions(); // Add hashtag storyOptions.Hashtags.Add(new InstaStoryHashtagUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.3148148, Height = 0.110367894, Rotation = 0, TagName = "IRAN" }); // Add poll question storyOptions.Polls.Add(new InstaStoryPollUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.3148148, Height = 0.110367894, Rotation = 0, Question = "Do you love IRAN?", Answer1 = "Are", // "YES" answer Answer2 = "Na" // "NO" answer }); // Add location var locationsResult = await api.LocationProcessor.SearchLocationAsync(0, 0, "kazeroun").ConfigureAwait(false); var firstLocation = locationsResult.Value.FirstOrDefault(); var locationId = firstLocation.ExternalId; storyOptions.Locations.Add(new InstaStoryLocationUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.3148148, Height = 0.110367894, Rotation = 0, LocationId = locationId }); // Mention people storyOptions.Mentions.Add(new InstaStoryMentionUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.7972222, Height = 0.21962096, Rotation = 0, Username = "******" }); // Add story question storyOptions.Questions.Add(new InstaStoryQuestionUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.9507363, Height = 0.32469338000000003, Rotation = 0, Question = "What do you think about InstagramApiSharp?!", BackgroundColor = "#ffffff", // #ffffff is white TextColor = "#000000" // #000000 is black }); var image = new InstaImage { Uri = @"c:\someawesomepicture.jpg" }; var result = await api.StoryProcessor.UploadStoryPhotoAsync(image, "someawesomepicture", storyOptions).ConfigureAwait(false); // upload video //var result = await InstaApi.MediaProcessor.UploadVideoAsync(video, "ramtinak", storyOptions); Console.WriteLine(result.Succeeded ? $"Story created: {result.Value.Media.Pk}" : $"Unable to upload photo story: {result.Info.Message}"); }
public async void UploadWithOptions() { // You can add hashtags or locations or poll questions to your photo/video stories! // Note that you must draw your hashtags/location names/poll questions in your image first and then upload it! var storyOptions = new InstaStoryUploadOptions(); // Add hashtag storyOptions.Hashtags.Add(new InstaStoryHashtagUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.3148148, Height = 0.110367894, Rotation = 0, TagName = "IRAN" }); // Add poll question storyOptions.Polls.Add(new InstaStoryPollUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.3148148, Height = 0.110367894, Rotation = 0, Question = "Do you love IRAN?", Answer1 = "Are", // "YES" answer Answer2 = "Na" // "NO" answer }); // Add location var locationsResult = await InstaApi.LocationProcessor.SearchLocationAsync(0, 0, "kazeroun"); var firstLocation = locationsResult.Value.FirstOrDefault(); var locationId = firstLocation.ExternalId; storyOptions.Locations.Add(new InstaStoryLocationUpload { X = 0.5, // center of image Y = 0.5, // center of image Z = 0, Width = 0.3148148, Height = 0.110367894, Rotation = 0, LocationId = locationId }); var image = new InstaImage { Uri = @"c:\someawesomepicture.jpg" }; var result = await InstaApi.StoryProcessor.UploadStoryPhotoAsync(image, "someawesomepicture", storyOptions); // upload video //var result = await InstaApi.MediaProcessor.UploadVideoAsync(video, "ramtinak", storyOptions); Console.WriteLine(result.Succeeded ? $"Story created: {result.Value.Media.Pk}" : $"Unable to upload photo story: {result.Info.Message}"); }