예제 #1
0
        static void Do(string url)
        {
            var links = FeedReader.GetFeedUrlsFromUrlAsync(url).Result;

            foreach (var link in links)
            {
                try
                {
                    string title = link.Title;
                    if (string.IsNullOrEmpty(title))
                    {
                        title = url.Replace("https", "").Replace("http", "").Replace("www.", "");
                    }
                    title = Regex.Replace(title.ToLower(), "[^a-z]*", "");
                    var curl = FeedReader.GetAbsoluteFeedUrl(url, link);

                    string content = Helpers.DownloadAsync(curl.Url).Result;
                    System.IO.File.WriteAllText("c:\\data\\feeds\\" + title + "_" + Guid.NewGuid().ToString() + ".xml", content);
                    Console.Write("+");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(link.Title + " - " + link.Url + ": " + ex.ToString());
                }
            }
        }
예제 #2
0
        public async Task TestParseAndAbsoluteUrlDerStandard1()
        {
            string url   = "derstandard.at";
            var    links = await FeedReader.GetFeedUrlsFromUrlAsync(url).ConfigureAwait(false);

            foreach (var link in links)
            {
                var absoluteUrl = FeedReader.GetAbsoluteFeedUrl(url, link);
                Assert.IsTrue(absoluteUrl.Url.StartsWith("http://"));
            }
        }
예제 #3
0
        public void TestParseAndAbsoluteUrlDerStandard1()
        {
            string url   = "derstandard.at";
            var    links = FeedReader.GetFeedUrlsFromUrl(url);

            foreach (var link in links)
            {
                var absoluteUrl = FeedReader.GetAbsoluteFeedUrl(url, link);
                Assert.IsTrue(absoluteUrl.Url.StartsWith("http://"));
            }
        }