docs icon indicating copy to clipboard operation
docs copied to clipboard

使用cheerio插件 不能套双层语法

Open developer-wlj opened this issue 3 years ago • 3 comments

代码如下: const $= load(res.data); load(($('.torrentname .embedded:eq(1)',li).contents().not('[nodeType]=3'))[($('.torrentname .embedded:eq(1)',li).contents().not('[nodeType]=3')).length-1]).text().trim()

在电脑上用node测试能获取到文本,在app里提示content.forEach is not a function

image

developer-wlj avatar May 09 '21 05:05 developer-wlj

解决了 没有使用再套一层语法, 直接数组后面点 属性 就可以了 我前天试的不行 今天不知怎么又可以点了

developer-wlj avatar May 09 '21 11:05 developer-wlj

@developer-wlj 可能是 content 为 null 了

linroid avatar May 11 '21 05:05 linroid

@ developer-wlj可能是content为null了

今天又遇到这个问题了,电脑的node能正常获取,用dora运行报错,能考虑下个版本更新修复吗,今天遇到的这个问题,我实在想不到,别的解决方法

developer-wlj avatar May 14 '21 15:05 developer-wlj