Created
June 12, 2020 17:29
-
-
Save anuraj/20ac9e5530ce40922332df6fbc079e3b to your computer and use it in GitHub Desktop.
News Search using Bing News Search API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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