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>
Code
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
I want get link and title in a div but SelectSingleNode retrieving duplicate value..
How to get true.
This is the correct usage:
TextBox1.Text &= node.SelectSingleNode("//a[@class='video-box']").Attributes("title").Value
TextBox1.Text &= node.SelectSingleNode("//a[@class='video-box']").Attributes("href").Value
If you see the examples page http://htmlagilitypack.codeplex.com/wikipage?title=Examples, the very first example shows how to access attributes..
so in your case
For Each node In getir2
dim aTag as HtmlAgilityPack.HtmlNode = node.SelectSingleNode("//a[@class='video-box']")
TextBox1.Text += aTag["href"].value
'and for the title
TextBox1.Text += aTag["title"].value
Next
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With