/// <summary> /// Resolve... thing. (beatmap page.) /// </summary> public static async Task <BeatmapSet> resolveThing(string url) { try { string rawData = await Web.GetContent(url); // no cookies needed for this in fact if (rawData.Contains("looking for was not found")) { return(null); } var htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.OptionUseIdAttribute = true; htmlDoc.LoadHtml(rawData); // get the set id string setIdInfo = HttpUtility.HtmlDecode(htmlDoc.DocumentNode.SelectSingleNode("//div[@class='posttext']/img[@class='bmt']").Attributes["src"].Value); string setId = setIdRegex.Match(setIdInfo).Groups[1].ToString(); HtmlAgilityPack.HtmlNode infoNode = htmlDoc.DocumentNode.SelectSingleNode("//table[@id='songinfo']"); return(new BeatmapSet( setId, HttpUtility.HtmlDecode(infoNode.SelectSingleNode("tr[1]/td[2]/a").InnerText), // artist HttpUtility.HtmlDecode(infoNode.SelectSingleNode("tr[2]/td[2]/a").InnerText), // title HttpUtility.HtmlDecode(infoNode.SelectSingleNode("tr[3]/td[2]/a").InnerText), // mapper null, new Dictionary <string, string>(), null )); } catch { return(null); } }
private List <Order> ScanOrders(HtmlAgilityPack.HtmlNode node, string prefix) { List <Order> orders = new List <Order>(); foreach (HtmlAgilityPack.HtmlNode order in node.SelectNodes(".//div[contains(@class, 'order')]")) { HtmlAgilityPack.HtmlNode info = order.SelectSingleNode(".//div[contains(@class, 'order-info')]"); Order o = new Order(); if (info != null) { HtmlAgilityPack.HtmlNode price = info.SelectSingleNode(".//div[contains(@class, 'a-span2')]//span[contains(@class, 'value')]"); if (price != null) { o.Sum = ScanPrice(price.InnerText.Trim()); } HtmlAgilityPack.HtmlNode id = info.SelectSingleNode(".//div[contains(@class, 'a-col-right')]//span[contains(@class, 'value')]"); if (id != null) { o.Id = id.InnerText.Trim(); } HtmlAgilityPack.HtmlNode date = info.SelectSingleNode(".//div[contains(@class, 'a-span4')]//span[contains(@class, 'value')]"); if (date != null) { o.Date = ScanDate(date.InnerText.Trim()); } } if (o.IsInitialized()) { foreach (HtmlAgilityPack.HtmlNode product in order.SelectNodes(".//div[contains(@class, 'a-spacing')]//div[contains(@class, 'a-col-right')]")) { HtmlAgilityPack.HtmlNode name = product.SelectSingleNode(".//a[contains(@class, 'a-link-normal')]"); HtmlAgilityPack.HtmlNode price = product.SelectSingleNode(".//span[contains(@class, 'a-color-price')]"); if ((name != null) && (price != null)) { Product p = new Product(); p.Price = ScanPrice(price.InnerText.Trim()); p.Url = name.Attributes["href"].Value.StartsWith("http") ? name.Attributes["href"].Value : prefix + name.Attributes["href"].Value; p.Name = WebUtility.HtmlDecode(name.InnerText.Trim()); o.Products.Add(p); } } orders.Add(o); } } return(orders); }
public UsageDetail(HtmlAgilityPack.HtmlNode node) { Day = DateTime.Parse(node.SelectSingleNode("td/span[@class='full-date']").InnerText); Downstream = ParseData(node.SelectSingleNode("td[@class='downstream']").InnerText); Upstream = ParseData(node.SelectSingleNode("td[@class='upstream']").InnerText); Combined = ParseData(node.SelectSingleNode("td[@class='combined']").InnerText); var runningTotal = node.SelectSingleNode("td[@class='running-total']"); if (runningTotal != null) { RunningTotal = ParseData(runningTotal.InnerText); } }
private string GetHtmlNodeValue(HtmlAgilityPack.HtmlNode hn, ThinkCrawlField field) { string value = ""; if (hn == null) { return(value); } var node = hn.SelectSingleNode(field.XPath); if (node != null) { if (!string.IsNullOrEmpty(field.Attr)) { value = GetHtmlNodeAttributeValue(node, field.Attr); } else if (field.IsHtml) { value = node.InnerHtml; } else { value = StringUtil.RemoveHTML(node.InnerText); } } return(value); }
static HtmlAgilityPack.HtmlNode GetReleaseMain(HtmlAgilityPack.HtmlNode doc) { HtmlAgilityPack.HtmlNode releaseMain = doc.SelectSingleNode("//div[contains(@class,'release-entry')]"); if (releaseMain == null) { releaseMain = doc.SelectSingleNode("//div[contains(@class,'label-latest')]"); } if (releaseMain == null) { return(doc); } else { return(releaseMain); } }
public static Event FromHtmlNode(HtmlAgilityPack.HtmlNode tr) { Event evt = new Event(); try { string href = ""; HtmlAgilityPack.HtmlNode link = tr.SelectSingleNode(".//a[1]"); if (link != null) { href = "http://www.ynet.co.il" + link.Attributes["href"].Value; } string text = tr.InnerHtml.Substring(0, tr.InnerHtml.IndexOf("<br>")); string datetime = tr.InnerHtml.Substring(tr.InnerHtml.IndexOf("<br>") + "<br>".Length); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(text); text = HttpUtility.HtmlDecode(doc.DocumentNode.InnerText); doc.LoadHtml(datetime); datetime = doc.DocumentNode.InnerText; evt.Text = text; evt.Time = ToDateTime(datetime); evt.RefUrl = href; evt.KeyWords = SetKeyWords(text); } catch (Exception exp) { } return(evt); }
/// <summary> /// Tries to get text from node and escapes it from HTML. /// </summary> private static string TryGetNodeText(HtmlAgilityPack.HtmlNode node, string xpath) { try { string txt = node.SelectSingleNode(xpath).InnerText; return(HttpUtility.HtmlDecode(txt)); } catch { return("<Unknown>"); } }
public static HtmlAgilityPack.HtmlNode GetSingleNode(HtmlAgilityPack.HtmlNode node, params string[] arrTagName) { HtmlAgilityPack.HtmlNode result = node; arrTagName.ToList().ForEach(x => { result = result.SelectSingleNode(x); }); return(result); }
/// <summary> /// 分析从google获得源码 获取排名前50个url集合【导出前50个竞争对手的站点URL】 /// </summary> /// <param name="strHTMLCode"></param> /// <returns></returns> public List <string> GetUrlList(string strHTMLCode) { HtmlAgilityPack.HtmlDocument htmldoc = new HtmlAgilityPack.HtmlDocument(); htmldoc.LoadHtml(strHTMLCode); HtmlAgilityPack.HtmlNodeCollection hrefList = htmldoc.DocumentNode.SelectNodes(".//li[@class=\"g\"]"); //表示单个的节点 string strCite = ".//cite"; List <string> alistURL = new List <string>(); if (hrefList != null) { //foreach (HtmlAgilityPack.HtmlNode href in hrefList) //{ // //HtmlAgilityPack.HtmlAttribute att = href.Attributes["href"]; // //this.txtResult.AppendText(att.Value+Environment.NewLine); // //this.txtResult.AppendText(href.InnerText); // HtmlAgilityPack.HtmlNode node = href.SelectSingleNode(strCite); // this.txtResult.AppendText(node.InnerText); //} for (int i = 0; i < hrefList.Count; i++) { HtmlAgilityPack.HtmlNode curSpanNode = hrefList[i]; //bool bl = new CheckBox().Checked; //if (bl) //{ // //勾选 // HtmlAgilityPack.HtmlNodeCollection curImageNode = curSpanNode.SelectNodes(".//cite"); //} //else //{ // //不勾选 // HtmlAgilityPack.HtmlNode curImageNode = curSpanNode.SelectSingleNode(".//cite"); //} HtmlAgilityPack.HtmlNode curImageNode = curSpanNode.SelectSingleNode(strCite); if (curImageNode == null || curImageNode.InnerText == "") { continue; } alistURL.Add(OpearURL(curImageNode.InnerText)); //this.txtResult.AppendText(curImageNode.InnerText + Environment.NewLine); //HtmlAgilityPack.HtmlNode curLinkNode = curSpanNode.SelectSingleNode("a"); //ImageInfo image = new ImageInfo(); //image.Title = curLinkNode.InnerText; //image.SrcPath = curImageNode.Attributes["src"].Value; imageList.Add(image); } } return(alistURL); }
public override string Select(HtmlAgilityPack.HtmlNode element) { var node = element.SelectSingleNode(_xpath); if (node != null) { return(HasAttribute() ? node.Attributes[_attribute].Value?.Trim() : node.InnerHtml?.Trim()); } return(null); }
protected virtual void ParseThreadPage(String url, String doc, out Int32 lastPageNumber, out DateTimeOffset serverTime, ref Posts postList) { Int32 threadId = VBulletinForum.ThreadIdFromUrl(url); lastPageNumber = 0; var html = new HtmlAgilityPack.HtmlDocument(); html.LoadHtml(doc); HtmlAgilityPack.HtmlNode root = html.DocumentNode; serverTime = DateTime.Now; //(//div[class="smallfont", align="center'])[last()] All times are GMT ... The time is now <span class="time">time</span>"." HtmlAgilityPack.HtmlNode timeNode = root.SelectNodes("//div[@class='smallfont'][@align='center']/span[@class='time']/..").Last(); if (timeNode != null) { String timeText = timeNode.InnerText; serverTime = Utils.Misc.ParsePageTime(timeText, DateTime.UtcNow); } // find total posts: /table/tr[1]/td[2]/div[@class="pagenav"]/table[1]/tr[1]/td[1] -- Page 106 of 106 HtmlAgilityPack.HtmlNode pageNode = root.SelectSingleNode("//div[@class='pagenav']/table/tr/td"); if (pageNode != null) { string pages = pageNode.InnerText; Match m = Regex.Match(pages, @"Page (\d+) of (\d+)"); if (m.Success) { //Trace.TraceInformation("{0}/{1}", m.Groups[1].Value, m.Groups[2].Value); lastPageNumber = Convert.ToInt32(m.Groups[2].Value); } } // //div[@id='posts']/div/div/div/div/table/tbody/tr[2] // td[1]/div[1] has (id with post #, <a> with user id, user name.) // td[2]/div[1] has title // td[2]/div[2] has post // "/html[1]/body[1]/table[2]/tr[2]/td[1]/td[1]/div[2]/div[1]/div[1]/div[1]/div[1]/table[1]/tr[2]/td[2]/div[2]" is a post HtmlAgilityPack.HtmlNodeCollection posts = root.SelectNodes("//div[@id='posts']//div[contains(@id, 'edit')]/table/tr[2]/td[2]/div[contains(@id, 'post_message_')]"); if (posts == null) { return; } postList = new Posts(); foreach (HtmlAgilityPack.HtmlNode post in posts) { Post p = HtmlToPost(threadId, post, serverTime); if (p != null) { postList.Add(p); } } }
/// <summary> /// parset planetinformationen /// </summary> /// <param name="planetNode">Html Knoten, der die Planetinformationen enthält</param> public Planet(HtmlAgilityPack.HtmlNode planetNode, StringManager strings, Logger logger) { logger.Log(LoggingCategories.Parse, "Planet Constructor"); this._name = planetNode.SelectSingleNode(strings.PlanetNameXPath).InnerText; //Koordinaten auslesen: string coordsString = planetNode.SelectSingleNode(strings.PlanetCoordsXPath).InnerText; System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match(coordsString, strings.PlanetCoordsRegex); //Koordinaten Parsen this._coords.Galaxy = Convert.ToInt32(match.Groups [1].Value); this._coords.SunSystem = Convert.ToInt32(match.Groups [2].Value); this._coords.Place = Convert.ToInt32(match.Groups [3].Value); //Link auslesen: string linktToPlanet = planetNode.SelectSingleNode(strings.PlanetLinkXPath).Attributes ["href"].Value; this._id = Utils.StringReplaceToInt32(Utils.SimpleRegex(linktToPlanet, strings.PlanetIDRegex)); }
protected override float?getRating(HtmlAgilityPack.HtmlNode node) { var ratingNode = node.SelectSingleNode(rating2XPath); if (ratingNode != null) { var attr = ratingNode.Attributes["content"]; return(Convert.ToSingle(attr.Value)); } return(null); }
private void LoadSprintInformation(Sprint sprint, HtmlAgilityPack.HtmlNode htmlNode) { var sectionList = htmlNode.SelectSingleNode("//*[@id='infoPanel']").Descendants().Where(t => t.Name == "tr").ToList(); var IterationSection = sectionList[3]; var durationItem = IterationSection.ChildNodes.Where(t => t.Name == "td").ToList()[1]; var startAndEndTime = durationItem.InnerText.Split('-'); sprint.StartTime = DateTime.Parse(startAndEndTime[0]); sprint.EndTime = DateTime.Parse(startAndEndTime[1]); }
private List <string> searchPage(string htmlPage, string type) { HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(htmlPage); List <string> res = new List <string>(); if (htmlDoc.DocumentNode != null) // gets the root of the document { HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body"); if (bodyNode != null) { HtmlAgilityPack.HtmlNode divNode = bodyNode.SelectSingleNode("//div[@class='CentralArea']"); HtmlAgilityPack.HtmlNode tableNode = divNode.SelectSingleNode("//table[@class='FbOuterYukon']"); int count = 0; string feedback = String.Empty; foreach (HtmlAgilityPack.HtmlNode node in tableNode.ChildNodes) { if (count == 0) { count++; continue; } if (node.WriteContentTo().Contains("info90daysMsg")) { continue; } if (count % 2 == 1) { feedback = node.ChildNodes[1].InnerText; } else { //if (node.ChildNodes[1].InnerText.Contains(Product)) if (node.ChildNodes[1].InnerText.IndexOf(Product, StringComparison.CurrentCultureIgnoreCase) != -1) { res.Add(feedback); if (type == positive) { App.positiveWriter.Write(feedback); } else { App.negativeWriter.Write(feedback); } } } count++; } } } return(res); }
public static string GetAttribute(HtmlAgilityPack.HtmlNode doc, string xpath, string attributeName) { string result = string.Empty; var node = doc.SelectSingleNode(xpath); if (node != null) { result = node.Attributes[attributeName].Value; } return(result); }
public static string GetInnerText(HtmlAgilityPack.HtmlNode doc, string xpath) { string result = string.Empty; var node = doc.SelectSingleNode(xpath); if (node != null) { result = node.InnerText.Trim(); } return(result); }
private string monDetailPg(HtmlAgilityPack.HtmlNode monNode) { HtmlAgilityPack.HtmlDocument _doc = new HtmlAgilityPack.HtmlDocument(); HtmlAgilityPack.HtmlDocument subdoc = new HtmlAgilityPack.HtmlDocument(); var monN = monNode.SelectSingleNode("td[1]/a").InnerText; var suburl = monNode.SelectSingleNode("td[1]/a").GetAttributeValue("href", ""); if (!monUrlSet.Contains(suburl) && suburl.StartsWith("/cn/")) { monUrlSet.Add(suburl); Uri monLink = new Uri(DBsettings.monURL + suburl); var monCrawl = WebRequest.RequestAction(new RequestOptions() { Uri = monLink, Method = "Get" }); subdoc.LoadHtml(monCrawl); var monName = subdoc.DocumentNode.SelectSingleNode("//h4"); var detailTab = subdoc.DocumentNode.SelectSingleNode("//div[@class = 'tab-content'][1]/div[1]/table"); if (detailTab.SelectNodes("tr").Count > 16) { //todo: add td according to th var monTd = detailTab.SelectNodes("tr[position() = 1 or position() > 2 and position() < 15]/td"); //new element var _tr = _doc.CreateElement("tr"); _tr.InnerHtml += "<td>" + monName.InnerHtml + "</td>"; foreach (var td in monTd) { _tr.AppendChild(td); } //final add tr outerhtml to montable return(_tr.OuterHtml); } Console.Out.WriteLine("Getting " + monN + " page failed"); } return(""); }
protected string GetNodeText(HtmlAgilityPack.HtmlNode item, string XPath) { var tmp = item.SelectSingleNode(XPath); if (tmp != null) { var s = HtmlAgilityPack.HtmlEntity.DeEntitize(tmp.InnerText); return(s.Trim()); } else { return(""); } }
public int getSumPages() { string positive_link = getParameterLink(getSource(getUserLink()), positive); string negative_link = getParameterLink(getSource(getUserLink()), negative); string positive_source = getSource(positive_link); string negative_source = getSource(positive_link); //List<string> res = searchPage(param_source, parameter); HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(positive_source); HtmlAgilityPack.HtmlNode pagination = htmlDoc.DocumentNode.SelectSingleNode("//body").SelectSingleNode("//div[@id='CentralArea']").SelectSingleNode("//div[@class='newPagination']"); HtmlAgilityPack.HtmlNode pgn_pagination = pagination.SelectSingleNode("//b[@id='PGN_pagination1']"); Regex max_page_regex = new Regex(@">(\d+)</a></b>"); int max_pages = Int32.Parse(max_page_regex.Match(pgn_pagination.WriteTo()).Groups[1].ToString()); SUM_OF_PAGES += max_pages; htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(negative_source); pagination = htmlDoc.DocumentNode.SelectSingleNode("//body").SelectSingleNode("//div[@id='CentralArea']").SelectSingleNode("//div[@class='newPagination']"); pgn_pagination = pagination.SelectSingleNode("//b[@id='PGN_pagination1']"); max_pages = Int32.Parse(max_page_regex.Match(pgn_pagination.WriteTo()).Groups[1].ToString()); SUM_OF_PAGES += max_pages; return(SUM_OF_PAGES); }
/// <summary> /// 获取其他页面 /// </summary> public string getCertainPage(string subUrl) { var _subUrl = subUrl.Split('/'); Uri uri = new Uri(DBsettings.DBURL + (_subUrl.Count() > 1 ? _subUrl[1] : subUrl)); string resp = ""; HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); var simpleCrawlResult = WebRequest.RequestAction(new RequestOptions() { Uri = uri, Method = "Get" }); //加载页面 doc.LoadHtml(simpleCrawlResult); //tab-content HtmlAgilityPack.HtmlNode tab_content = doc.DocumentNode.SelectSingleNode("//div[@class = 'tab-content']"); if (subUrl.Contains('/')) { tab_content = tab_content.SelectSingleNode(".//div[1]"); } //areaTab_Main = tab_content.SelectSingleNode("div[@class = 'table-responsive']"); //blue-area tab //HtmlAgilityPack.HtmlNode headlineN = doc.DocumentNode.SelectSingleNode("//div[@id = 'navbarColor02']"); //areaTab_B = headlineN.SelectNodes(".//a")?.ToArray(); //gray-area tab //HtmlAgilityPack.HtmlNode gray_nav = doc.DocumentNode.SelectSingleNode("//ul[@class = 'nav nav-tabs d-flex flex-wrap']"); //areaTab_G = headlineN.SelectNodes(".//a")?.ToArray(); //monster_list HtmlAgilityPack.HtmlNode inputNode = doc.DocumentNode.SelectSingleNode("//div[@class = 'query input-group']"); resp = inputNode?.OuterHtml; if (subUrl == "mon.php") { //get monster detail list resp += monPage(); } else if (tab_content == null) { return("<h1>Content not found</h1>"); } else { //return main page tab-content html resp += tab_content.InnerHtml; } return(resp); }
public Task(HtmlAgilityPack.HtmlNode taskNode) { if (taskNode != null) { this.question = taskNode.SelectSingleNode("./div[@class='question']").InnerHtml ?? ""; var answerList = taskNode.SelectNodes("./div[@class='answer']"); if (answerList != null) { foreach (var answerNode in answerList) { this.answers.Add(answerNode.InnerHtml ?? ""); } } } }
public void FullLocation(PNLocationInfo localInfo) { this.mHtmlDoc.OptionOutputOriginalCase = true; string queryUrl = "http://api.showji.com/Locating/www.showji.com.aspx?m=" + localInfo.PhoneNumber; Uri queryUri = new Uri(queryUrl); try { Stream stream = this.mWebClient.OpenRead(queryUri); StreamReader sr = new StreamReader(stream, Encoding.UTF8); string result = sr.ReadToEnd(); this.mHtmlDoc.LoadHtml(result); } catch (Exception ex) { localInfo.Result = "访问服务时出错:" + ex.Message; return; } HtmlAgilityPack.HtmlNode rootNode = this.mHtmlDoc.DocumentNode.SelectSingleNode("//queryresponse"); if (rootNode == null) { localInfo.Result = "服务返回结构不正确"; return; } HtmlAgilityPack.HtmlNode nodeQueryResult = rootNode.SelectSingleNode("queryresult"); if (nodeQueryResult == null || string.Equals(nodeQueryResult.InnerText, "false", StringComparison.CurrentCultureIgnoreCase)) { localInfo.Result = "服务没有结果返回"; return; } localInfo.PhoneNumber = rootNode.SelectSingleNode("mobile").InnerText; localInfo.Segment.Province = rootNode.SelectSingleNode("province").InnerText; localInfo.Segment.City = rootNode.SelectSingleNode("city").InnerText; localInfo.Segment.AreaCode = rootNode.SelectSingleNode("areacode").InnerText; localInfo.Segment.PostCode = rootNode.SelectSingleNode("postcode").InnerText; localInfo.Segment.CardType = rootNode.SelectSingleNode("corp").InnerText; localInfo.Segment.CardType += " " + rootNode.SelectSingleNode("card").InnerText; localInfo.Result = string.Empty; }
public override dynamic Select(HtmlAgilityPack.HtmlNode element) { var node = element.SelectSingleNode(_xpath); if (node != null) { if (HasAttribute()) { return(node.Attributes.Contains(_attribute) ? node.Attributes[_attribute].Value?.Trim() : null); } else { return(node); } } return(null); }
/* * parameter could be positive, negative or neutral. * */ private string getParameterLink(string htmlSource, string parameter) { HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(htmlSource); if (htmlDoc.DocumentNode != null) // gets the root of the document { HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body"); if (bodyNode != null) { string match = "//a[@title='" + parameter + "']"; string v = bodyNode.SelectSingleNode("//div[@id='feedback_ratings']").SelectSingleNode(match).WriteTo(); Regex reg = new Regex(@"<a href=\x22([^\x22]+)\x22"); return(reg.Match(v).Groups[1].ToString()); } } return(""); }
private void LoadStoryInformation(Sprint sprint) { HtmlAgilityPack.HtmlNode htmlNode = FeatureData(sprint.Url); LoadSprintInformation(sprint, htmlNode); var storyList = htmlNode.SelectSingleNode("//*[@id='iterationfeatures']").Descendants().Where(t => t.Name == "tr").ToList(); int total = storyList.Count(); int current = 0; foreach (var storyItem in storyList) { var storyItemColumn = storyItem.ChildNodes.Where(t => t.Name == "td").ToList(); var Id = SpiderUtil.TrimHtmlTag(storyItemColumn[1].ChildNodes.Where(t => t.Name == "a").ToList().First().InnerText); if (string.IsNullOrEmpty(Id)) { Id = SpiderUtil.TrimHtmlTag(storyItemColumn[1].ChildNodes.First().InnerText); } var name = SpiderUtil.TrimHtmlTag(storyItemColumn[2].ChildNodes.Where(t => t.Name == "div").ToList().First().InnerText); var type = SpiderUtil.TrimHtmlTag(storyItemColumn[3].Attributes["title"].Value); var priority = int.Parse(SpiderUtil.TrimHtmlTag(storyItemColumn[4].InnerText)); var owner = SpiderUtil.TrimHtmlTag(storyItemColumn[5].ChildNodes.Last().InnerText); var status = SpiderUtil.TrimHtmlTag(storyItemColumn[6].Attributes["title"].Value); decimal size = decimal.Parse(SpiderUtil.TrimHtmlTag(storyItemColumn[7].InnerText)); Story story = new Story(); story.ID = Id; story.Title = name; story.Type = ConvertToStoryType(type); story.Priority = priority; story.Owner = owner; story.Status = (StoryStatus)Enum.Parse(typeof(StoryStatus), status.Replace(" ", "")); story.Size = size; LoadStoryCreateAndModifiedTime(story); LoadStoryTaskInfomation(story); sprint.Stories.Add(story); if (!IsFirstFetch) { current++; FetchProgressChanged(total, current); } } }
static public DialogueMissionLocation MissionLocationFromDialogue(this HtmlAgilityPack.HtmlNode node) { var SecurityLevelMilli = node?.Descendants()?.Select(descendant => Number.NumberParseDecimalMilli(descendant?.InnerText?.Trim())) ?.WhereNotDefault() ?.FirstOrDefault(); var NameNode = node?.SelectSingleNode(".//a"); var Name = NameNode?.InnerText?.Trim(); return(new DialogueMissionLocation() { Name = Name, SecurityLevelMilli = (int?)SecurityLevelMilli, SystemName = Name?.AsLocation()?.SystemName, }); }
private List <Tuple <string, string> > EnumerateHeroComparisonTypes(HtmlAgilityPack.HtmlNode rootNode) { var types = new List <Tuple <string, string> >(); var selectNode = rootNode.SelectSingleNode(".//select[@data-group-id='comparisons']"); foreach (var optionNode in selectNode.ChildNodes) { if (optionNode.Name == "option") { var item = new Tuple <string, string>( optionNode.GetAttributeValue("option-id", string.Empty), optionNode.GetAttributeValue("value", string.Empty)); types.Add(item); } } return(types); }
public override int DiscoverDynamicCategories() { int dynamicCategoriesCount = 0; String baseWebData = GetWebData(ApetitTvUtil.baseUrl, forceUTF8: true); HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument(); document.LoadHtml(baseWebData); HtmlAgilityPack.HtmlNodeCollection categories = document.DocumentNode.SelectNodes(".//div[@class='clear']/div/div[@class='view-footer']/div"); foreach (var category in categories) { HtmlAgilityPack.HtmlNode cat1 = category.SelectSingleNode(".//div[@class='view-header']/h3/text()"); HtmlAgilityPack.HtmlNode cat2 = category.SelectSingleNode(".//div[@class='view-header']/a"); if (cat1 != null) { this.Settings.Categories.Add( new RssLink() { Name = cat1.InnerText, Other = category }); dynamicCategoriesCount++; } else if (cat2 != null) { this.Settings.Categories.Add( new RssLink() { Name = cat2.SelectSingleNode(".//text()").InnerText, Url = Utils.FormatAbsoluteUrl(cat2.Attributes["href"].Value, ApetitTvUtil.baseUrl) }); dynamicCategoriesCount++; } } this.Settings.DynamicCategoriesDiscovered = true; return(dynamicCategoriesCount); }
private Dictionary <string, string> GetSprintItems() { var result = new Dictionary <string, string>(); HtmlAgilityPack.HtmlNode htmlNode = FeatureData(url); var menu = htmlNode.SelectSingleNode("//*[@id='navMenuBar']/div/ul"); var interations = menu.ChildNodes.Where(t => t.Name == "li").ToList()[2]; var allSprints = interations.Descendants().Where(t => t.Name == "li").ToList(); foreach (var sprintItem in allSprints) { var sprintName = sprintItem.InnerText; var sprintUrl = sprintItem.ChildNodes.First().Attributes["href"].Value; result.Add(sprintName, sprintUrl); } return(result); }