1

我正在使用 Apify 并且爬行速度非常可怕。我需要浏览大约 12,500 页的房产列表。

起始页: https ://www.sreality.cz/hledani/prodej/byty?strana=1

链接选择器:a[href]

伪 URL: https://www.sreality.cz/detail/prodej/byt/[.+]/[.+]/[.+] https://www.sreality.cz/hledani/prodej/byty?斯特拉纳=[.+]

第一个是公寓的细节 第二个是下一页

我的页面功能:

异步函数 pageFunction(context) {

const { request, log, skipLinks, jQuery: $, waitFor } = context;
const pageTitle = $('title').first().text();

context.log.info(`URL: ${context.request.url}, TITLE: ${pageTitle}`);

if (request.userData.label === 'DETAIL') {
return {
    url: context.request.url,
    pageTitle,
    name: $('span.name.ng-binding').eq(3).text(),
    };

}

}

现在我只是在刮名字。我想先解决速度。

感谢您的任何答案:)

4

1 回答 1

0

我假设您使用的是使用 Chromium 浏览器的Web Scraper ( https://apify.com/apify/web-scraper )。在这种情况下,速度会受到许多因素的影响,包括运行内存设置、加载资源过程以及渲染数据所需的时间。请在此处查看限制部分以获取更多信息:https ://apify.com/apify/web-scraper#limitations

您可以尝试Cheerio Scraper ( https://apify.com/apify/cheerio-scraper ) 以获得高性能,如果这不起作用,您可以尝试Puppeteer Scraper ( https://apify.com/apify/puppeteer-scraper ) 这使您可以更好地控制抓取过程(例如阻止不必要的资源)。

于 2020-03-07T11:40:53.693 回答