vb抓取网页内容(EndSub显示GoogleChrome显示的相同代码。怎么了?)
优采云 发布时间: 2022-04-08 04:09vb抓取网页内容(EndSub显示GoogleChrome显示的相同代码。怎么了?)
我正在尝试创建一个 Windows 桌面应用程序,该应用程序将转到指定站点并从该站点获取 HTML。我发现了很多这样做的例子,但由于某种原因,它不适用于传统的 Google 协作平台页面。该程序需要在 Google 协作平台页面的正文中找到简单的文本。当您“查看页面源代码”时,它不会显示与 Google Chrome 显示相同的代码。怎么了?
<p>Public Sub Scrape(strURL)
Try
Dim wrResponse As WebResponse
Dim wrRequest As WebRequest = HttpWebRequest.Create(strURL)
textScrape = "Extracting..." & Environment.NewLine
wrResponse = wrRequest.GetResponse()
Using sr As New StreamReader(wrResponse.GetResponseStream())
strOutput = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
End Using
textScrape = strOutput
'Formatting Techniques
' Remove Doctype ( HTML 5 )
strOutput = Regex.Replace(strOutput, "", "")
' Remove HTML Tags
' strOutput = Regex.Replace(strOutput, "", "")
' Remove HTML Comments
' strOutput = Regex.Replace(strOutput, "", "")
' Remove Script Tags
' strOutput = Regex.Replace(strOutput, "]*>", "")
' Remove HTML Comments
' strOutput = Regex.Replace(strOutput, "", "")
' Remove Script Tags
' strOutput = Regex.Replace(strOutput, "