如何解析html并获取不在任何标签内的文本(使用cheerio)?

时间:2019-12-08 08:54:24

标签: node.js typescript web-scraping cheerio htmlparse

我有一个需要解析的html页面,但是文本的某些部分不在任何html标记内,如何使用cheerio访问这些文本?

html结构如下:

#include <iostream>
#include <algorithm>

bool mycompare(const int a, const int b)
{
    return a > b;
}

int main (void) {

    int a[] = { 5, 4, 3, 1, 2, 6, 7 };
    size_t n = sizeof a / sizeof *a;

    std::sort (a, a + n, mycompare);

    for (size_t i = 0; i < n; i++)
        std::cout << " " << a[i];
    std::cout << '\n';
}

我想得到所有这些文本

编辑: 我可以访问这些文本,我正在寻找一种方便的方法来访问数组中的文本,或者像其他具有标签的元素一样。

0 个答案:

没有答案