public void TestReadStrategyEx() { var feed = FeedReader.ReadAsync("http://blog.strategyex.com/feed/").Result; Assert.AreEqual("Strategy Execution Blog", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadRssScottHanselmanWeb() { var feed = await FeedReader.ReadAsync("http://feeds.hanselman.com/ScottHanselman").ConfigureAwait(false); Assert.IsTrue(!string.IsNullOrEmpty(feed.Title)); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadTimeDoctor() { var feed = await FeedReader.ReadAsync("https://www.timedoctor.com/blog/feed/").ConfigureAwait(false); Assert.AreEqual("Time Doctor", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public Task <IList <Model.FeedItem> > DownloadRssFeedAsync(Model.Feed feed) { return(Task.Run(async() => { IList <Model.FeedItem> feedItems = new List <Model.FeedItem>(); var rssFeed = await FeedReader.ReadAsync(feed.Url); // TO ACCESS CUSTOM FEED METADATA BY RSS FEED VERSION // NOT USED AT THE MOMENT if (rssFeed.Type == FeedType.Rss_2_0) { var rss20feed = (CodeHollow.FeedReader.Feeds.Rss20Feed)rssFeed.SpecificFeed; } Console.WriteLine($"FeedDownloader.DownloadRssFeedAsync(): loading RSS feed from {feed.Url}"); foreach (var item in rssFeed.Items) { var newItem = MapSyndicationFeedItemToFeedItem(item, rssFeed.Type); if (newItem != null) { newItem.FeedId = feed.Id; feedItems.Add(newItem); } } Console.WriteLine($"FeedDownloader.DownloadRssFeedAsync(): retrieved {feedItems.Count} feed items"); return feedItems; })); }
public async Task TestReadAtomFeedHeise() { var feed = await FeedReader.ReadAsync("https://www.heise.de/newsticker/heise-atom.xml").ConfigureAwait(false); Assert.IsTrue(!string.IsNullOrEmpty(feed.Title)); Assert.IsTrue(feed.Items.Count > 1); }
public async Task TestReadTheStudentLawyer() { var feed = await FeedReader.ReadAsync("http://us10.campaign-archive.com/feed?u=8da2e137a07b178e5d9a71c2c&id=9134b0cc95").ConfigureAwait(false); Assert.AreEqual("The Student Lawyer Careers Network Archive Feed", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task <IList <RssItem> > GetRssItems(string url) { try { var feed = await FeedReader.ReadAsync(url); var rssItems = new List <RssItem>(); foreach (var item in feed.Items) { var rssItem = new RssItem { Title = item.Title, Url = item.Link }; rssItems.Add(rssItem); } return(rssItems); } catch (Exception e) { //Handle exception properly throw new Exception(e.Message); } }
private static void ParseFeeds() { if (config.OutputToConsole) { Console.WriteLine($"\nParsing feeds at {DateTime.Now}"); } foreach (RssFeed k in config.Feeds) { k.LatestFeed = FeedReader.ReadAsync(k.FeedUrl).Result; } foreach (RssFeed k in config.Feeds) { ParseFeed(k); } if (config.AnyReadPostStorage) { PurgeReadPosts(); } SaveConfig(); if (config.OutputToConsole) { Console.WriteLine($"\nFinished parsing feeds at {DateTime.Now}"); } }
public async Task <FeedData> GetData() { try { FeedData feedData = new FeedData(); Feed feed = await FeedReader.ReadAsync(rssFeed); feedData.Title = feed.Title; feedData.ImageUri = new Uri(feed.ImageUrl); if (feed != null) { foreach (var element in feed.Items) { FeedItem feedItem = new FeedItem(); feedItem.Title = element.Title; feedItem.Description = element.Description; feedItem.Link = element.Link; if (feed.Type == FeedType.Rss_2_0) { } feedData.Items.Add(feedItem); } } return(feedData); } catch { return(null); } }
public void TestReadLiveBold() { var feed = FeedReader.ReadAsync("http://feeds.feedburner.com/LiveBoldAndBloom").Result; Assert.AreEqual("Live Bold and Bloom", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public List <Noticia> Load(int totalDeNoticias) { var key = $"noticias_"; List <Noticia> noticias; if (!_memoryCache.TryGetValue(key, out noticias)) { noticias = new List <Noticia>(); var feed = FeedReader.ReadAsync("https://g1.globo.com/rss/g1/turismo-e-viagem/").Result; foreach (var item in feed.Items) { var feedItem = item.SpecificItem as CodeHollow.FeedReader.Feeds.MediaRssFeedItem; var media = feedItem.Media; var url = ""; if (media.Any()) { url = media.FirstOrDefault().Url; } noticias.Add(new Noticia() { Id = 1, Titulo = item.Title, Link = item.Link, Imagem = url }); } var cacheOptions = new MemoryCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(2)); //var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration( TimeSpan.FromMinutes(2)); _memoryCache.Set(key, noticias, cacheOptions); } return(noticias); }
public void TestReadThaqafnafsak() { var feed = FeedReader.ReadAsync("http://www.thaqafnafsak.com/feed").Result; Assert.AreEqual("ثقف نفسك", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public void TestReadAPOD() { var feed = FeedReader.ReadAsync("https://apod.nasa.gov/apod.rss").Result; Assert.AreEqual("APOD", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public void TestReadTechRep() { var feed = FeedReader.ReadAsync("http://www.techrepublic.com/rssfeeds/topic/project-management/").Result; Assert.AreEqual("Project Management on TechRepublic", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadAPOD() { var feed = await FeedReader.ReadAsync("https://apod.nasa.gov/apod.rss").ConfigureAwait(false); Assert.AreEqual("APOD", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestPermanentMove() { var feed = await FeedReader.ReadAsync("http://t3n.de/tag/blockchain/rss.xml").ConfigureAwait(false); Assert.IsTrue(feed.Title.StartsWith("t3n.de - Blockchain")); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadThaqafnafsak() { var feed = await FeedReader.ReadAsync("http://www.thaqafnafsak.com/feed").ConfigureAwait(false); Assert.AreEqual("ثقف نفسك", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
private static async Task <FeedData> DownloadFeed(FeedCfg feedCfg) { try { var lastRefresh = DateTime.Now; var feed = await FeedReader.ReadAsync(feedCfg.InterpolateUrl()); if (feed?.Items == null || feed.Items.Count <= 0) { return(null); } feedCfg.PendingRefreshDate = lastRefresh; var feedData = await DownloadFeedContents(new FeedData(feedCfg, feed)); if (feedData == null) { return(null); } feedData.NewItems = feedData.NewItems .OrderByDescending(fi => fi.PublishingDate ?? DateTime.MinValue) .ToList(); return(feedData); } catch (Exception ex) { LogTo.Warning(ex, $"Exception while reading feed {feedCfg.Name}"); } return(null); }
public async Task TestReadLiveBold() { var feed = await FeedReader.ReadAsync("http://feeds.feedburner.com/LiveBoldAndBloom").ConfigureAwait(false); Assert.AreEqual("Live Bold and Bloom", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public static async Task <YoutubeFeed> ReadAsync(string youtubeChannelId) { try { var feedUrl = $"{_youtubeFeedUrl}{youtubeChannelId}"; var feed = await FeedReader.ReadAsync(feedUrl); var videos = feed.Items.Select(x => new YoutubeVideo { Id = x.Id, DatePublished = DateTimeOffset.Parse(x.PublishingDateString), Url = x.Link, User = x.Author }).ToList(); return(new YoutubeFeed { YoutubeVideos = videos }); } catch (XmlException e) { return(new YoutubeFeed { YoutubeVideos = new List <YoutubeVideo>() }); } }
/// <summary> /// Returns the items from the give feed source(url). /// </summary> /// <param name="feedSource"></param> /// <returns></returns> public async Task <IList <FeedItem> > GetFeedItemsAsync(string feedSource) { if (string.IsNullOrEmpty(feedSource)) { return(null); } try { var feed = await FeedReader.ReadAsync(feedSource); if (feed == null) { return(null); } if (feed.Items == null) { return(null); } return(feed.Items.ToList()); } catch (Exception ex) { return(null); } }
public static async Task <List <BikeItem> > SearchAsync(string query) { var sourceUrl = $"https://washingtondc.craigslist.org/search/sss?format=rss&hasPic=1&max_price=100&query={query}&sort=date"; var rss = await FeedReader.ReadAsync(sourceUrl); var items = rss.Items.Select(s => new BikeItem() { Id = s.Id, Text = HtmlEntity.DeEntitize(s.Title), Description = HtmlEntity.DeEntitize(s.Description), Image = s.SpecificItem.Element.Descendants().FirstOrDefault(x => x.Name.LocalName == "enclosure")?.Attribute("resource")?.Value, Price = 10, Link = s.Link, }).ToList(); foreach (var item in items) { var match = Regex.Match(item.Text, "\\$(\\d+)"); if (match.Success) { item.Price = Convert.ToDouble(match.Groups[1].Value); } } return(items); }
public async Task <(FeedModel, string)> FetchAsync(string url) { try { var feed = await FeedReader.ReadAsync(url); var mapper = ModelMapper.Init(); foreach (var feedItems in feed.Items) { if (string.IsNullOrEmpty(feedItems.Author)) { var xele = feedItems.SpecificItem.Element.Descendants().ToList(); var author = xele.Where(x => x.Name.LocalName == "creator").Select(x => x.Value ).FirstOrDefault(); if (author != null) { feedItems.Author = author; } } } var FeedModel = mapper.Map <Feed, FeedModel>(feed); return(FeedModel, string.Empty); } catch (Exception exp) { return(null, exp.Message); } }
public async Task TestReadTheLPM() { var feed = await FeedReader.ReadAsync("https://thelazyprojectmanager.wordpress.com/feed/").ConfigureAwait(false); Assert.AreEqual("The Lazy Project Manager's Blog", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadRss20GermanFeedPowershell() { var feed = await FeedReader.ReadAsync("http://www.powershell.co.at/feed/").ConfigureAwait(false); Assert.IsTrue(!string.IsNullOrEmpty(feed.Title)); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadStrategyEx() { var feed = await FeedReader.ReadAsync("http://blog.strategyex.com/feed/").ConfigureAwait(false); Assert.AreEqual("Strategy Execution Blog", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadNoticiasCatolicas() { var feed = await FeedReader.ReadAsync("feeds.feedburner.com/NoticiasCatolicasAleteia").ConfigureAwait(false); Assert.AreEqual("Noticias Catolicas", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadTechRep() { var feed = await FeedReader.ReadAsync("http://www.techrepublic.com/rssfeeds/topic/project-management/").ConfigureAwait(false); Assert.AreEqual("Project Management on TechRepublic", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public async Task TestReadMikeC() { var feed = await FeedReader.ReadAsync("https://mikeclayton.wordpress.com/feed/").ConfigureAwait(false); Assert.AreEqual("Shift Happens!", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }
public void TestReadTheLPM() { var feed = FeedReader.ReadAsync("https://thelazyprojectmanager.wordpress.com/feed/").Result; Assert.AreEqual("The Lazy Project Manager's Blog", feed.Title); Assert.IsTrue(feed.Items.Count > 0); }