【问题标题】:How to increase the speed of crawling in Apify?Apify中如何提高爬取速度?
【发布时间】:2020-03-05 18:38:27
【问题描述】:

我用的是 Apify,爬的速度太可怕了。我需要浏览大约 12,500 页的房产列表。

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

链接选择器: 一个[href]

伪网址: https://www.sreality.cz/detail/prodej/byt/[.+]/[.+]/[.+] https://www.sreality.cz/hledani/prodej/byty?strana=[.+]

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

我的页面功能:

异步函数 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(),
    };

}

}

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

感谢您的任何回答:)

【问题讨论】:

  • 您使用了多少内存?您看到了哪些性能结果?

标签: apify


【解决方案1】:

我假设您使用的是使用 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-10-22
    • 2023-03-06
    • 1970-01-01
    • 1970-01-01
    • 2015-06-15
    • 2019-06-22
    • 2016-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多