I try to scrape the entire table by NodeJS+CheerioJS which has structure like this
<table class="table table-hover table-info">
<caption></caption>
<thead> // 1 <tr>
</thead>
<tbody> // 12 <tr>
</tbody>
<thead> // 1 <tr>
</thead>
<tbody> // 7 <tr>
</tbody>
</table>
that webpage has only 1 table with 2 thead and 2 tbody
what I had tried is
$('table').filter(function(){
var data = $(this);
console.log(data.find('thead').length) // print '2'
console.log(data.find('tbody').length) // should print '2' but it print '1'
console.log(data.find('tr').length) // should print '21' but it print '14'
})
the result should be 2, 2 and 21 but it returned me 2, 1 and 14
any idea how to get the second tbody ?
p.s. I also tried
$('table.table.table-hover.table-info').filter(function(){
// same code
})
it still return 2,1,14 :/
Thank you
via AimeTPGM
No comments:
Post a Comment