public Company() { Alexa = new Alexa(); SiteRankData = new SiteRankData(); SimilarWeb = new SimilarWeb(); GTmetrix = new GTmetrix(); Whois = new Whois(); }
private static Alexa AlexaAnalyse(string companyUrl) { var uri = @"https://www.alexa.com/siteinfo/" + companyUrl; HtmlWeb web = new HtmlWeb(); HtmlDocument doc = new HtmlDocument(); try { doc = web.Load(uri); } catch (Exception) { } var globalRank = doc.DocumentNode.SelectSingleNode(AlexaSelector.GlobalRank)?.InnerText.RemoveNumericFormat().TryToInt(); var iranRank = doc.DocumentNode.SelectSingleNode(AlexaSelector.IranRank)?.InnerText.RemoveNumericFormat().TryToInt(); var rankDiffernce = doc.DocumentNode.SelectSingleNode(AlexaSelector.RankDiffernce)?.InnerText.RemoveNumericFormat().TryToInt(); var imagePath = doc.DocumentNode.SelectSingleNode(AlexaSelector.ImagePath)?.InnerText.Trim(); var bounceRate = doc.DocumentNode.SelectSingleNode(AlexaSelector.BounceRate)?.InnerText.RemoveNumericFormat().TryToDecimal(); var dailyPageView = doc.DocumentNode.SelectSingleNode(AlexaSelector.DailyPageView)?.InnerText.TryToDecimal(); var dailyTime = doc.DocumentNode.SelectSingleNode(AlexaSelector.DailyTime)?.InnerText.Split(':')[0].TryToInt(); var keyword1 = doc.DocumentNode.SelectSingleNode(AlexaSelector.Keyword1)?.InnerText.Trim(); var keyword2 = doc.DocumentNode.SelectSingleNode(AlexaSelector.Keyword2)?.InnerText.Trim(); var keyword3 = doc.DocumentNode.SelectSingleNode(AlexaSelector.Keyword3)?.InnerText.Trim(); var keyword4 = doc.DocumentNode.SelectSingleNode(AlexaSelector.Keyword4)?.InnerText.Trim(); var keyword5 = doc.DocumentNode.SelectSingleNode(AlexaSelector.Keyword5)?.InnerText.Trim(); var backlinks = doc.DocumentNode.SelectSingleNode(AlexaSelector.Backlinks)?.InnerText.RemoveNumericFormat().TryToInt(); var alexa = new Alexa { GlobalRank = globalRank, IranRank = iranRank, RankDiffernce = rankDiffernce, ImagePath = imagePath, BounceRate = bounceRate, DailyPageView = dailyPageView, DailyTime = dailyTime, Keyword1 = keyword1, Keyword2 = keyword2, Keyword3 = keyword3, Keyword4 = keyword4, Keyword5 = keyword5, Backlinks = backlinks }; return(alexa); }
public string TitleCSV() { var result = $"نام شرکت,آدرس,{Alexa.TitleCSV()},{SiteRankData.TitleCSV()},{SimilarWeb.TitleCSV()},{GTmetrix.TitleCSV()},{Whois.TitleCSV()}{Environment.NewLine}"; return(result); }
public string CompanyToCSV() { var result = $"{Name},{Url},{Alexa.ToCSV()},{SiteRankData.ToCSV()},{SimilarWeb.ToCSV()},{GTmetrix.ToCSV()},{Whois.ToCSV()}{Environment.NewLine}"; return(result); }