table-scraper
Version:
Easily scrape any website's html table data into an array of JavaScript objects.
31 lines (30 loc) • 878 B
HTML
<html>
<head>
</head>
<body>
<h1>Multiple Tables Page Title!</h1>
<table>
<thead>
<tr>
<th>State</th><th>Capital City</th><th>Pop.<th>
</tr>
</thead>
<tbody>
<tr><td>Minnesota</td><td>Saint Paul</td><td>3</td></tr>
<tr><td>New York</td><td>Albany</td><td>Eight Million</td></tr>
</tbody>
</table>
<div><p>some other element</p></div>
<!-- should be identical to table above, only without thead/tbody -->
<table>
<tr><th>State</th><th>Capital City</th><th>Pop.</th></tr>
<tr><td>Minnesota</td><td>Saint Paul</td><td>3</td></tr>
<tr><td>New York</td><td>Albany</td><td>Eight Million</td></tr>
</table>
<!-- no column headers -->
<table>
<tr><td>a</td><td>b</td><td>c</td></tr>
<tr><td>1</td><td>2</td><td>3</td></tr>
</table>
</body>
</html>