Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2012 getting specific tags/text with HtmlAgilityPack

$
0
0
Hello, i'd like to know how i could extract specific information from websites like Twitch using HtmlAgilityPack.
For example lets use this random channel:
http://www.twitch.tv/grossie_gore

I would like to extract channel_viewer_count, views_count and followers_count.
HTML Code:

</SPAN> <A class="dropdown_static action" id="button_share"
href="">
<SPAN>Share</SPAN></A> <A class="dropdown_glyph action" id="button_options"
href="">
<SPAN>Options</SPAN></A> </DIV>
<DIV id="channel_stats"><SPAN class="stat" id="channel_viewer_count"
original-title="Watching Now">
1,608</SPAN> <SPAN class="stat" id="views_count"
original-title="Channel Views">
1,728,160</SPAN> <SPAN class="stat" id="followers_count"
original-title="Followers">
17,768</SPAN> </DIV></DIV>

Right now i have this:
Code:

        Dim site As HtmlAgilityPack.HtmlWeb = New HtmlWeb()
        Dim document As HtmlAgilityPack.HtmlDocument = site.Load("http://www.twitch.tv/grossie_gore")
        For Each table As HtmlNode In document.DocumentNode.SelectNodes("//span[@class='stat']")
            TextBox3.Text = (table.InnerText)
        Next

The problem is that it only extracts the last value
HTML Code:

SPAN class="stat" id="followers_count"
Also, what are ChildNodes and how to use them?

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>