I have the following HTML in a webpage that I want to mine for data:
<td id="topdisplay" class="menu-item">
<div class="bg">
<a href="/game.php?village=55303&screen=ranking">Ranking</a>
<div class="rank">
(4<span class="grey">.</span>120.|2<span class="grey">.</span>124 P)
</div>
<table class="menu_column" cellspacing="0">
</div>
</td>
I want to get the data inside the rank class and get the numbers, in this case 4120|2124 P. I tried to do this:
var point = document.getElementById("topdisplay");
alert(point.innerHTML);
end();
I received this:
<div class="bg">
<a href="/game.php?village=55303&screen=ranking">Ranking</a>
<div class="rank">
(4<span class="grey">.</span>120.|2<span class="grey">.</span>124 P)
</div>
<table class="menu_column" cellspacing="0">
<tbody>
<tr>
<td class="menu-column-item">
<a href="/game.php?village=55303&screen=ranking&mode=ally">Tribes</a>
</td>
</tr>
<tr>
<td class="menu-column-item">
<a href="/game.php?village=55303&screen=ranking&mode=player">Player</a>
</td>
</tr>
<tr>
<td class="menu-column-item">
<a href="/game.php?village=55303&screen=ranking&mode=con_ally">Continent Tribes</a>
</td>
</tr>
<tr>
<td class="menu-column-item">
<a href="/game.php?village=55303&screen=ranking&mode=con_player">Continent Players</a>
</td>
</tr>
<tr>
<td class="menu-column-item">
<a href="/game.php?village=55303&screen=ranking&mode=kill_ally">Opponents defeated tribal ranking</a>
</td>
</tr>
<tr>
<td class="menu-column-item">
<a href="/game.php?village=55303&screen=ranking&mode=kill_player">Opponents defeated</a>
</td>
</tr>
<tr>
<td class="menu-column-item">
<a href="/game.php?village=55303&screen=ranking&mode=awards">Awards</a>
</td>
</tr>
<tr>
<td class="bottom">
<div class="corner">
</div>
<div class="decoration">
</div>
</td>
</tr>
</tbody>
</table>
</div>
How can I filter the data here? I just want to extract the numbers from the first DIV class.