I am trying to use the Instagram API Sharp C# API to try and return a list of currently trending hashtags. I found a page where the feature was added, but I don't think I understand how to implement it.
Here is a link to how the developer said to implement it: https://github.com/ramtinak/InstagramApiSharp/issues/227
Here are the errors I am getting when I add it to my project
public static async Task<List<String>> GetPopularTags()
{
var test = InstaApi.HashtagProcessor.GetTopHashtagMediaListAsync("plant", PaginationParameters.MaxPagesToLoad(1)).Wait();
}
I am new to programming in general so it might be a simple fix. Any help would be appreciated.
Turns out I needed to create an instance of InstaApi
and use that to grab the list of Hashtags
public static IInstaApi api = InstaApiBuilder.CreateBuilder().SetUser(userSession)
.UseLogger(new DebugLogger(InstagramApiSharp.Logger.LogLevel.All))
.Build();
public static async Task<List<String>> GetPopularTags()
{
var test = await api.HashtagProcessor.GetTopHashtagMediaListAsync("plant", PaginationParameters.MaxPagesToLoad(1));
}
Also I was using the .Wait()
method incorrectly. I had to add 'await' in front in order to receive the result properly.