public void SiteCollectionProcessor() { //Got nesting? var siteCollection = new SiteCollection { FantasySites = new List <FantasySite> { new FantasySite { PageUrl = string.Empty, SiteName = "Site 1", PageParseParams = new PageParseParams { TableXPath = "//table[1]", NameCellParams = new CellParseParams { CellXPath = "td[1]" }, RankCellParams = new CellParseParams { CellXPath = "td[2]" }, PositionCellParams = new CellParseParams { CellXPath = "td[3]" } } }, new FantasySite { PageUrl = string.Empty, SiteName = "Site 2", PageParseParams = new PageParseParams { TableXPath = "//table[1]", NameCellParams = new CellParseParams { CellXPath = "td[1]" }, RankCellParams = new CellParseParams { CellXPath = "td[2]" }, PositionCellParams = new CellParseParams { CellXPath = "td[3]" } } } } }; var siteCollectionProcessor = new SiteCollectionProcessor(new FakeHtmlLoader()); var playerAggregates = siteCollectionProcessor.Process(siteCollection); Assert.Equal(1, playerAggregates.Count); }
public static void Main(string[] args) { var siteCollection = new SiteCollection { FantasySites = new List <FantasySite> { new FantasySite { PageUrl = "https://www.fantasypros.com/nfl/rankings/consensus-cheatsheets.php", PageParseParams = new PageParseParams { TableXPath = "//table[1]", NameCellParams = new CellParseParams { CellXPath = "td[2]/a" }, RankCellParams = new CellParseParams { CellXPath = "td[1]" }, PositionCellParams = new CellParseParams { CellXPath = "td[2]" } } }, new FantasySite { PageUrl = "http://fantasy.nfl.com/research/rankings?leagueId=0&statType=draftStats", PageParseParams = new PageParseParams { TableXPath = "//table[1]", NameCellParams = new CellParseParams { CellXPath = "td[2]/div/a" }, RankCellParams = new CellParseParams { CellXPath = "td[1]" }, PositionCellParams = new CellParseParams { CellXPath = "td[2]/div/em", IndexPosition = 0, SplitOnValue = "-" } } }, new FantasySite { PageUrl = "http://www.fantasyfootballnerd.com/fantasy-football-draft-rankings", PageParseParams = new PageParseParams { TableXPath = "//table[1]", NameCellParams = new CellParseParams { CellXPath = "td[4]/a" }, RankCellParams = new CellParseParams { CellXPath = "td[1]" }, PositionCellParams = new CellParseParams { CellXPath = "td[3]" } } } } }; var siteCollectionProcessor = new SiteCollectionProcessor(new CachedHtmlLoader()); var playerAggregates = siteCollectionProcessor.Process(siteCollection); foreach (var player in playerAggregates) { Console.WriteLine($"{player.Rank} {player.Name} {player.Position}"); } Console.ReadKey(); }