为什么会出现此错误?
"Illegal characters in path" at
htmlDoc.Load(pageSource)
pageSource
是 HTML 页面的字符串变量。我需要将页面源作为字符串传递,而不是作为文件而不是 URL。我该怎么做?
Dim ids As New List(Of String)()
Dim pageSource = getHtml(url)
Dim htmlDoc As HtmlDocument = New HtmlDocument()
htmlDoc.OptionFixNestedTags = True
htmlDoc.Load(pageSource)
Dim s As HtmlNodeCollection = htmlDoc.DocumentNode.SelectNodes("//div/@id")
For Each div As HtmlNode In s
ids.Add(div.Id)
Next
最佳答案
关于c# - 传递 HTML 页面字符串并使用 HtmlAgilityPack 进行抓取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11589469/