static void Main(string[] args) { var twitter = new TwitterSearch(); foreach (var tweet in twitter.Search(100, "data","visualization")) { Console.WriteLine(tweet); Regex linkParser = new Regex(@"\b(?:http://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); foreach (Match m in linkParser.Matches(tweet.Text)) { var fullUrl = m.Value.ExpandUrl(); var scraper = new PageScraper(fullUrl); foreach (var img in scraper.GetImages()) { Debug.Print(img); } } } }
public IEnumerable<string> Fetch(params string[] query) { HashSet<string> seenUrls = new HashSet<string>(); var twitter = new TwitterSearch(); foreach (var tweet in twitter.Search(10, 1, query)) { Regex linkParser = new Regex(@"\b(?:http://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); foreach (Match m in linkParser.Matches(tweet.Text)) { var fullUrl = m.Value.ExpandUrl(); Debug.Print(fullUrl); if (seenUrls.Contains(fullUrl)) { continue; } var scraper = new PageScraper(fullUrl); foreach (var img in scraper.GetImages()) { yield return img; } seenUrls.Add(fullUrl); } } }