【发布时间】:2016-04-11 00:49:37
【问题描述】:
问题一:
我有一个程序用于提取具有特定内容 (/articles/) 的网页 (WebSource) 的网址
Dim links As New List(Of String)()
Dim htmlDoc As New HtmlAgilityPack.HtmlDocument()
htmlDoc.LoadHtml(WebSource)
For Each link As HtmlNode In htmlDoc.DocumentNode.SelectNodes("//a[@href]")
Dim att As HtmlAttribute = link.Attributes("href")
If att.Value.Contains("/articles/") Then
links.Add(att.Value)
End If
Next
是否可以在 url 中搜索并按两个值过滤它们,例如在一个技术站点中,我想查找所有包含 /articles/ 和 LG 的 url
问题二:
提取的 url 不是完整的 HTTP 地址,例如我的结果之一是
/articles/car
例如,而不是完整的地址
http://website.com/articles/car
我该如何解决这个问题?
【问题讨论】:
标签: html vb.net parsing html-parsing html-agility-pack