最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

很难用Cheerio刮擦细胞

IT培训 admin 11浏览 0评论

很难用Cheerio刮擦细胞

[我正在尝试从表中抓取一个单元格,但是我很难过,我可能做错了什么,因为我在控制台中得到的结果是空的(实际上什么也没有。)>

这里是HTML:

我正在尝试获取<td class="center bold storing_1">1</td>

这是我的代码:

const rp = require('request-promise');
const cheerio = require('cheerio');
const url = 'MY URL';

rp(url)
.then(function(html) {

  $ = cheerio.load(body);
  console.log($('#table_results tbody tr:nth-child(1) td.center.bold.sorting_1')).text();

})
.catch(function(err) {
});

感谢您的帮助!谢谢!

我正在尝试从表中抓取一个单元格,但是我很难受,并且我可能做错了什么,因为我在控制台中得到的结果是空的(实际上什么都没有)。这是HTML:我是...

回答如下:

我认为您的代码实际上还可以,我想您只是输入了一些错字。

很难用Cheerio刮擦细胞

[我正在尝试从表中抓取一个单元格,但是我很难过,我可能做错了什么,因为我在控制台中得到的结果是空的(实际上什么也没有。)>

这里是HTML:

我正在尝试获取<td class="center bold storing_1">1</td>

这是我的代码:

const rp = require('request-promise');
const cheerio = require('cheerio');
const url = 'MY URL';

rp(url)
.then(function(html) {

  $ = cheerio.load(body);
  console.log($('#table_results tbody tr:nth-child(1) td.center.bold.sorting_1')).text();

})
.catch(function(err) {
});

感谢您的帮助!谢谢!

我正在尝试从表中抓取一个单元格,但是我很难受,并且我可能做错了什么,因为我在控制台中得到的结果是空的(实际上什么都没有)。这是HTML:我是...

回答如下:

我认为您的代码实际上还可以,我想您只是输入了一些错字。

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论