Html – Is it possible to web scrape with AngularJS?

angularjshtmlmeteorweb scraping

I'm trying to access a table online inside of my meteor-angular app. The table on the website looks like this:

<table class="Grid GridBrowse">
<tbody>
<tr class="GRH">

    //one of the items
<tr>
    <td><a class="ItmTLnk" href="itemLink">ITEM ID</a></td>
    <td>
        <a class="tn1"href="itemLink"><img alt="" src="http://someLink.com/thumb.jpg" /></a>
    </td>
    <td class="ttC">
        <div>
            <a href="itemLink" class="BItmTLnk">ITEM TITLE</a>
        </div>

    </td>
    <td class="lrt">ITEM PRICE</td>
</tr>
    //end item
</tbody>
</table>

JSFiddle of Table

There are multiple <td> items in the table that all look like the one in the fiddle, all have the same class names. I need to iterate over them in order to get to the Item ID, image, title, and price.

How can I pull in this table and then iterate over it to get these elements?

Best Answer

I think what you're asking just requires standard Javascript. Try this.

var elements = document.getElementsByClassName('ItmTLnk');

You'll end up with an array of the matching elements and have access to the element properties.