Skip to content

Instantly share code, notes, and snippets.

@anuraj
Created June 12, 2020 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anuraj/20ac9e5530ce40922332df6fbc079e3b to your computer and use it in GitHub Desktop.
Save anuraj/20ac9e5530ce40922332df6fbc079e3b to your computer and use it in GitHub Desktop.
News Search using Bing News Search API
//Add reference of Microsoft.Azure.CognitiveServices.Search.NewsSearch Package
using Microsoft.Azure.CognitiveServices.Search.NewsSearch;
public static async Task<News> GetSearchResults(string searchTerm)
{
var searchClient = new NewsSearchClient(new ApiKeyServiceClientCredentials(SearchApiKey));
return await searchClient.News.SearchAsync(query: searchTerm, market: "en-us", count: 5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment