News Stories
Retrieving news stories is a two-step process:
- We have to first retrieve the headlines and extract the story ID from each
// Retrieve the latest news headline in English about Apple.
IHeadlinesResponse headline = Headlines.Definition().Query($"L:EN and Apple,")
.Sort(Headlines.SortOrder.oldToNew)
.Count(1)
.GetData();
// Get the story ID of the first (and in this case, the only) news headline
var storyID = headline.Data.Headlines[0]?.StoryId;
- Using the storyID from step 1, we request the news story content like this
IStoryResponse story = Story.Definition(storyID).GetData();
// The result contains a raw json, headline title, story content as simple text or html content
var raw = story.Data.Raw;
var headlineTitle = story.Data.HeadlineTitle;
var storyText = story.Data.NewsStory;
var storyHtmlText = story.Data.HtmlNewsStory;