gpt4 book ai didi

HtmlAgilityPack 基本如何获取标题和链接?

转载 作者:可可西里 更新时间:2023-11-01 13:11:35 30 4
gpt4 key购买 nike

HTML

<div class="col">                   
<a class="video-box" title="En son haber" href="http://**/en-son-haber">
<img class="img-responsive" alt="en son haber" src="http://**/thumb/6/9/6/200x120/en-son-haber-49-29.jpg">
<span class="title">En son haber</span>
<span class="duration">01:02</span><span class="view-count">9.023</span></a>
</div>

代码

 Dim request2 As HttpWebRequest = WebRequest.Create("http://**.com/")
Dim response2 As HttpWebResponse = request2.GetResponse()
Dim reader2 As StreamReader = New StreamReader(response2.GetResponseStream())
Dim sayfa2 As String = reader2.ReadToEnd()
Dim dokuman2 = New HtmlAgilityPack.HtmlDocument()
dokuman2.LoadHtml(sayfa2)

Dim getir2 As HtmlAgilityPack.HtmlNodeCollection = dokuman2.DocumentNode.SelectNodes("//div[@class='col']")
For Each node In getir2
TextBox1.Text += node.SelectSingleNode("//a[@class='video-box']").SelectSingleNode("href").InnerText
Next

我想在 div 中获取 linktitleSelectSingleNode 检索重复值..

如何实现。

最佳答案

这是正确的用法:

TextBox1.Text &= node.SelectSingleNode("//a[@class='video-box']").Attributes("title").Value
TextBox1.Text &= node.SelectSingleNode("//a[@class='video-box']").Attributes("href").Value

关于HtmlAgilityPack 基本如何获取标题和链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20180026/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com