我正在使用流阅读器来获取某些页面的 HTML,但有些行我想忽略,例如一行以<span>
有什么建议吗?这是我的功能
Public Function GetPageHTMLReaderNoPrx(ByVal address As Uri) As StreamReader
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Try
request = DirectCast(WebRequest.Create(address), HttpWebRequest)
response = DirectCast(request.GetResponse(), HttpWebResponse)
Select Case CType(response, Net.HttpWebResponse).StatusCode
Case 200
reader = New StreamReader(response.GetResponseStream(), Encoding.Default)
Case Else
MsgBox(CType(response, Net.HttpWebResponse).StatusCode)
End Select
Catch
If Not response Is Nothing Then response.Close()
End Try
Return reader
End Function
这就是 HTML 的样子
<tr>Text
<span>show all</span>
</tr>