0
<html>
<body>
<table>
<tbody>
<tr>
<!-- More things here -->
</tr>
<tr>
<td>
<table></table>
<table>
<tbody>
<tr>
<td></td>
<td>I want this</td>
</tr>
</tbody>
</table>
<table></table>
</td>
</tr>
<tr>
<!-- More things here -->
</tr>
</tbody>
</table>
</body>
</html>
Das ist also die seltsam aussehende HTML-Struktur. Das Element, das ich möchte, ist das Element, das ich im HTML markiert habe.Parsing Tabelle mit Cheerio
Dies ist der Knoten Js Code, den ich verwende, um das HTML zu analysieren. Ich bin nicht sehr vertraut mit jQuery.
const $ = cheerio.load(body);
$('table').find('tbody tr:nth-child(1)').each(()=> {
$('td').find('table').each(() => {
console.log($(this).text())
})
})