From 7d9442b2f997c940f6d7bb88973f5c2cf9209b18 Mon Sep 17 00:00:00 2001 From: James Schafer Date: Sat, 10 Jun 2017 19:18:11 -0400 Subject: [PATCH] Successfully Parsed Data from the Theater Schedule HTML. --- .../DataAbstraction/TheaterScheduleHTMLParser.cs | 12 +++++++++++- Melody49Notifier/Melody49Notifier.csproj | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Melody49Notifier/DataAbstraction/TheaterScheduleHTMLParser.cs b/Melody49Notifier/DataAbstraction/TheaterScheduleHTMLParser.cs index acdd4a6..4209a5e 100644 --- a/Melody49Notifier/DataAbstraction/TheaterScheduleHTMLParser.cs +++ b/Melody49Notifier/DataAbstraction/TheaterScheduleHTMLParser.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Melody49Notifier.Models; using Microsoft.Azure.WebJobs.Host; +using HtmlAgilityPack; namespace Melody49Notifier.DataAbstraction { @@ -19,7 +20,16 @@ public TheaterScheduleHTMLParser(TraceWriter log) public TheaterSchedule ParseTheaterScheduleHTML(string html) { - throw new NotImplementedException(); + HtmlDocument htmlDocument = new HtmlDocument(); + htmlDocument.LoadHtml(html); + + TheaterSchedule theaterSchedule = new TheaterSchedule(); + + //theaterSchedule.ScheduleDescription = htmlDocument.DocumentNode.Descendants("div").Where(x => x?.Attributes?["id"]?.Value == "playweek").First().ChildNodes.First().InnerText; + + theaterSchedule.ScheduleDescription = htmlDocument.DocumentNode.SelectNodes("//div[@id=\"playweek\"]/p").First().InnerText; + + return theaterSchedule; } } } diff --git a/Melody49Notifier/Melody49Notifier.csproj b/Melody49Notifier/Melody49Notifier.csproj index 2bc4734..1efe7ae 100644 --- a/Melody49Notifier/Melody49Notifier.csproj +++ b/Melody49Notifier/Melody49Notifier.csproj @@ -3,6 +3,7 @@ net461 +