Hi im trying to Scrape a table of a website and list it in a datagridview wich has a column Name and a Url Link Please Help!!!!

Heres the source..

<div class="text"><table class="links">
        <thead>
        <tr class="thblue"><td style="width: 105px"></td><td style="width: 85px">Time</td><td style="width: 540px">Teams</td><td>Broadcast</td></tr>
        </thead>
    <tbody><img src='/img/nowplay.gif'><tr>
<td colspan='5' class='accordion greybg'><span class='icon'><img src='/img/disciplines/americanfootball.gif' alt='MyP2P American football' title='MyP2P American football'  ></img></span><span class='dt 1472950800'>01:00</span><span class='television'><a href='http://snake.googleme.eu/CVMpcNaHIs3LDyt3mLz3XddD' target='_blank'><img src='/img/broadcast.gif'></a></span><span class='live'>Live!</span><h4><a href='javascript:(void)'>Clemson - Auburn</a></h4><div class='module-desc'><BR><a href='http://snake.googleme.eu/CVMpcNaHIs3LDyt3mLz3XddD' target='_blank' title='Clemson - Auburn - Link 1'>Link 1</a> <a href='http://myp2p.biz/football/bz1ab3a4-clemson-auburn' target='_blank' title='Clemson - Auburn - Link 2'>Link 2</a> </div></td></tr>
<tr>
<td colspan='5' class='accordion greybg'><span class='icon'><img src='/img/disciplines/baseball.gif' alt='MyP2P Baseball' title='MyP2P Baseball'></img></span><span class='dt 1472951100'>01:05</span><span class='television'><a href='http://myp2p.biz/baseball/bz1ab3ab-boston-red-sox-at-oakland-athletics' target='_blank'><img src='/img/broadcast.gif'></a></span><span class='live'>Live!</span><h4><a href='javascript:(void)'>Boston Red Sox at Oakland Athletics</a></h4><div class='module-desc'><BR><a href='http://myp2p.biz/baseball/bz1ab3ab-boston-red-sox-at-oakland-athletics' target='_blank' title='Boston Red Sox at Oakland Athletics - Link 1'>Link 1</a> </div></td></tr>
<tr>

Recommended Answers

Sounds like you need to make it smarter.

As in after line 2 have some tests to see IF you want to add that element.

Jump to Post

You are using Visual Studio. Set line 3 to break and examine what's in the variables. Note what you want and what you don't want. Code your if statement accordingly.

Jump to Post

I'm not there to see what's in what variable to craft your if statements. This is basic stuff but I can't write the if statement for you. But you can break on the line and look at the variables to see what's there then think about how you would write …

Jump to Post

All 9 Replies

Let's change that word scrape to parse. I see that if I do that I can research like this: https://www.google.com/search?q=parsing+html+in+vb.net

Parsing is something we get taught almost from the beginning in programming classes. So you already scraped the HTML and now you need to parse it.

This is what i got so far it works in collecting only the title and link but it gets extra links and titles.. please help!! Thank you..

    Dim PageElements As HtmlElementCollection = WebBrowser3.Document.GetElementsByTagName("a")
    For Each CurElement As HtmlElement In PageElements
        DataGridView1.Rows.Add(CurElement.GetAttribute("title"), (CurElement.GetAttribute("href")))

    Next

Sounds like you need to make it smarter.

As in after line 2 have some tests to see IF you want to add that element.

Any samples please..

You are using Visual Studio. Set line 3 to break and examine what's in the variables. Note what you want and what you don't want. Code your if statement accordingly.

Still no luck..

I'm not there to see what's in what variable to craft your if statements. This is basic stuff but I can't write the if statement for you. But you can break on the line and look at the variables to see what's there then think about how you would write a statement to not add or add if this or that.

This is the link to webpage http://мур2р.eu/ source..

SnapCrab_NoName_2016-9-8_18-32-20_No-00.png

This is my code..

SnapCrab_NoName_2016-9-8_18-45-48_No-00.png

This is what i collects in datagridview.. what i want is only channel names and Channel Links

SnapCrab_NoName_2016-9-8_18-40-59_No-00.png

Since I don't have vb.net installed (we are working C# code currently) all I can do is guide you. If you can't break on the line and look at the variables to divine what your if statement should be, then I'd want to know how you go this far without well, I leave it there.

You're close but you need to do the next step. Put an if statement to add or not add that data.

PS. Again I can't tell which is good or bad but when name's length looks to be zero, maybe that's the test you need?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.