public async Task <List <Episode> > getCalendar() { calendar = new List <Episode>(); string url = "http://followshows.com/api/calendar?date=" + (DateTime.UtcNow.Date.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds.ToString() + "&days=14"; Response resp = await(new Response(url)).call(); HtmlDocument doc = new HtmlDocument(); if (resp.page == null) { return(calendar); } doc.LoadHtml(resp.page); HtmlNode table = HTML.getChild(doc.DocumentNode, "class", "calendar"); HtmlNode tableRow = HTML.getChild(table, 1); bool check = false; foreach (HtmlNode day in tableRow.ChildNodes) { if (!HTML.getAttribute(day, "class").Contains("today") && check == false) { continue; } check = true; HtmlNode ul = HTML.getChild(day); if (ul != null) { foreach (HtmlNode li in ul.ChildNodes) { calendar.Add(Episode.getCalendarEpisode(li)); } } } return(calendar); }
public async Task <List <Episode> > getWatchList() { watchList = new List <Episode>(); Response resp = await(new Response("http://followshows.com/home/watchlist", false)).call(); HtmlDocument doc = new HtmlDocument(); if (resp.page == null) { return(watchList); } doc.LoadHtml(resp.page); foreach (HtmlNode episode in HTML.getChild(doc.DocumentNode.ChildNodes, "class", "videos-grid videos-grid-home clearfix episodes-popover").ChildNodes) { watchList.Add(Episode.getWatchListEpisode(episode)); } foreach (HtmlNode episode in HTML.getChild(doc.DocumentNode.ChildNodes, "class", "videos-grid-home-more clearfix episodes-popover").ChildNodes) { watchList.Add(Episode.getWatchListEpisode(episode)); } return(watchList); }