public static PageType FindPageType(ParsedWebpage Webpage) { if (CheckForHomePage(Webpage)) { return(PageType.HomePage); } if (CheckForBlogHomePage(Webpage)) { return(PageType.BlogHomePage); } if (CheckForBlogPage(Webpage)) { return(PageType.BlogPage); } return(PageType.Page); }
private static bool CheckForBlogPage(ParsedWebpage Webpage) { var path = Webpage.Url.AbsolutePath; if (path != "/blog" && path.StartsWith("/blog")) { return(true); } if (Webpage.Url.Segments.Last().Contains("blog") && Webpage.Url.Segments.Last().Length > 20) { return(true); } if (Webpage.SubDomain == "blog" && path != "/") { return(true); } return(false); }
private async void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (webBrowser1.ReadyState != WebBrowserReadyState.Complete || e.Url.AbsolutePath != (sender as WebBrowser).Url.AbsolutePath) { return; } else { EventLog.AppendLog("Page Loaded"); ParsedWebpage Webpage = await Manager.ReceiveWebpage(); textBox2.Text = Webpage.Url.ToString(); EventLog.AppendLog("Processing Complete"); EventLog.AppendLog("Title: " + Webpage.PageTitle); EventLog.AppendLog("Domain: " + Webpage.Domain); EventLog.AppendLog("URL: " + Webpage.Url); EventLog.AppendLog("Links: " + Webpage.Links.Count()); EventLog.AppendLog("Word Count: " + Webpage.WordCount.ToString()); string blogLink = Webpage.BlogLink == null ? "No" : "Yes"; EventLog.AppendLog("Blog Link: " + blogLink); if (Webpage.BlogLink != null) { EventLog.AppendLog(Webpage.BlogLink); } if (Manager.Complete) { button1.Enabled = true; } else { Manager.ExecuteNextTask(); } } }
private static bool CheckForHomePage(ParsedWebpage Webpage) { var path = Webpage.Url.AbsolutePath; if (Webpage.SubDomain != "" && Webpage.SubDomain != "www") { return(false); } if (path == "/") { return(true); } if (path.StartsWith("/index")) { return(true); } if (path.StartsWith("/home")) { return(true); } return(false); }