vb抓取网页内容(EndSub显示GoogleChrome显示的相同代码。怎么了?)

优采云 发布时间: 2022-04-08 04:09

  vb抓取网页内容(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()

&#39; Close and clean up the StreamReader

sr.Close()

End Using

textScrape = strOutput

&#39;Formatting Techniques

&#39; Remove Doctype ( HTML 5 )

strOutput = Regex.Replace(strOutput, "", "")

&#39; Remove HTML Tags

&#39; strOutput = Regex.Replace(strOutput, "", "")

&#39; Remove HTML Comments

&#39; strOutput = Regex.Replace(strOutput, "", "")

&#39; Remove Script Tags

&#39; strOutput = Regex.Replace(strOutput, "]*>", "")

&#39; Remove HTML Comments

&#39; strOutput = Regex.Replace(strOutput, "", "")

&#39; Remove Script Tags

&#39; strOutput = Regex.Replace(strOutput, "

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线