public Task <List <FeedItem> > GetFeed(NewsCategory category, string lang = "en", string locale = "us")
        {
            string feedUrl = $"https://news.google.com/news/rss/headlines?ned={locale}";

            if (category != NewsCategory.Headlines)
            {
                var catName = category.ToString();
                feedUrl = $"https://news.google.com/news/rss/headlines/section/topic/{catName.ToUpper()}.{lang}_{locale}/{catName}?ned={locale}&hl={lang}-{locale.ToUpper()}";
            }
            return(Task.FromResult(ReadRSS(feedUrl)));
        }
Beispiel #2
0
 private static string FormattedCategory(NewsCategory category)
 => category is NewsCategory.None
         ? string.Empty
         : $"&category={category.ToString().ToLowerInvariant()}";