如何从Apify刮板获得标签:Web,Cheerio和Puppeteer

时间:2019-12-26 16:27:28

标签: puppeteer cheerio apify

当我尝试根据Apify网站上的示例获取起始URL的标签时,出现错误2019-12-26T15:35:17.723Z INFO: request.userData.label: undefined

Cheerio刮刀example code

async function pageFunction(context) {
    const { request, log, skipLinks, $ } = context;
    log.info(`request.userData.label ${request.userData.label}`);
}

Pupperrer刮刀example code

async function pageFunction(context) {
    const { request, log, skipLinks, page } = context;
     log.info(`request.userData.label ${request.userData.label}`);

}

1 个答案:

答案 0 :(得分:0)

这在Introduction section中有解释。您需要为开始和伪URL设置标签。