Cheerio 不适用于标签 <td>

Cheerio don't work with tag <td>

const cheerio = require('cheerio');
var $ = cheerio.load('<td>check text</td>');
console.log($('td').text());

TD 和 TR 没有结果。我如何在不使用 类 或 id(仅)的情况下从 TD 和 TR 获取文本内容?

好吧,如果没有 table 元素作为父元素,td 元素就没有任何意义。以下代码段将按预期工作。

const cheerio = require('cheerio');
var $ = cheerio.load('<table><tr><td>check text</td></tr></table>');
console.log($('td').text());