mcpField
A
apify-ultimate-scraper

apify-ultimate-scraper

github.com/apify数据与数据库2.5k16.4k 次安装1 周前更新
代码仓库

关于 apify-ultimate-scraper

apify-ultimate-scraper 是通过 Apify CLI 选择并运行 Actor、从多个平台提取数据的网页抓取技能。它涵盖输入架构检查、任务执行、结果获取,以及快速查询和多步骤研究工作流。

主要功能

  1. 01按平台和任务查找 Actor
  2. 02检查 Actor 输入架构
  3. 03以 JSON 格式运行 Actor
  4. 04以 JSON 或 CSV 获取数据集结果
  5. 05支持快速和长时间抓取
  6. 06提供研究任务工作流指南

适用场景

  1. 01收集潜在客户和联系方式
  2. 02监测竞争对手广告或价格
  3. 03分析评价与社交媒体活动
  4. 04收集用于 SEO 或 RAG 的网页内容

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/apify/agent-skills --skill apify-ultimate-scraper

安装后在 Claude Code 中输入/apify-ultimate-scraper确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
actor-index.md
gotchas.md
references/workflows/
brand-monitoring.md
company-research.md
competitive-intel.md
contact-enrichment.md
content-and-seo.md
ecommerce-price-monitoring.md
influencer-vetting.md
job-market-and-recruitment.md
knowledge-base-and-rag.md
lead-generation.md
real-estate-and-hospitality.md
review-analysis.md
social-media-analytics.md
trend-research.md

详细介绍

通用网页抓取工具

通过 Apify CLI,从 15+ 个平台的约 100 个 Actor 中,利用 AI 驱动数据提取。

每个 apify 命令都必须遵守以下规则:

  1. 传入 --json,以获取机器可读的输出(在不同 CLI 版本间保持稳定)。
  2. 传入 --user-agent apify-agent-skills/apify-ultimate-scraper,以便进行遥测归因。
  3. 使用 2>/dev/null 重定向 stderr(stderr 包含会破坏 JSON 解析器的进度消息)。

前置条件

  • Apify CLI v1.5.0+(npm install -g apify-cli)
  • 已通过身份验证的会话(见下文)

身份验证

如果 CLI 命令因身份验证错误而失败,请使用以下任一方式进行身份验证:

  1. OAuth(交互式): apify login(会打开浏览器)
  2. 环境变量: export APIFY_TOKEN=your_token_here
  3. 从 .env 文件加载: source .env(如果该文件包含 APIFY_TOKEN=...)

生成令牌:https://console.apify.com/settings/integrations

工作流

步骤 1:了解目标并选择 Actor

确定目标平台和使用场景。阅读 references/actor-index.md,找到合适的 Actor。

如果任务涉及多步骤流水线,还要阅读相应的工作流指南:

任务涉及……阅读
潜在客户、联系人、电子邮件、B2Breferences/workflows/lead-generation.md
竞争对手、广告、定价references/workflows/competitive-intel.md
网红、创作者references/workflows/influencer-vetting.md
品牌、提及、情感倾向references/workflows/brand-monitoring.md
评论、评分、声誉references/workflows/review-analysis.md
SEO、SERP、抓取、内容、RAGreferences/workflows/content-and-seo.md
分析、互动、表现references/workflows/social-media-analytics.md
趋势、关键词、话题标签references/workflows/trend-research.md
职位、招聘、候选人references/workflows/job-market-and-recruitment.md
房地产、房源、酒店references/workflows/real-estate-and-hospitality.md
价格监控、电商、产品references/workflows/ecommerce-price-monitoring.md
联系人信息补全、电子邮件提取references/workflows/contact-enrichment.md
知识库、RAG、大模型数据源references/workflows/knowledge-base-and-rag.md
公司调查、尽职调查references/workflows/company-research.md

如果索引中没有匹配的 Actor,请动态搜索:

apify actors search "KEYWORDS" --user-agent apify-agent-skills/apify-ultimate-scraper --json --limit 10 2>/dev/null

从结果中读取:items[].username/items[].name(Actor ID)、items[].title、items[].stats.totalUsers30Days、items[].currentPricingInfo.pricingModel。

步骤 2:获取 Actor 架构并检查注意事项

动态获取输入架构:

apify actors info "ACTOR_ID" --user-agent apify-agent-skills/apify-ultimate-scraper --input --json 2>/dev/null

另请阅读 references/gotchas.md,了解所选 Actor 的常见陷阱。

Actor 文档:apify actors info "ACTOR_ID" --user-agent apify-agent-skills/apify-ultimate-scraper --readme

步骤 3:配置并运行

对于简单查询(例如“耐克的粉丝数”),跳过用户偏好确认。直接以快速回答模式运行。

对于较大的任务,确认输出格式(快速回答 / CSV / JSON)和结果数量。

标准运行(阻塞式):

apify actors call "ACTOR_ID" --input-file input.json --user-agent apify-agent-skills/apify-ultimate-scraper --json 2>/dev/null

对于较大或较复杂的输入,优先使用 --input-file input.json。对于很小的输入,可以使用 shell 引号内联 JSON:--input '{"maxItems":10}'。

从输出中获取:.id(运行 ID)、.status、.defaultDatasetId、.stats.durationMillis

获取结果:

apify datasets get-items DATASET_ID --user-agent apify-agent-skills/apify-ultimate-scraper --format json

对于 CSV:apify datasets get-items DATASET_ID --user-agent apify-agent-skills/apify-ultimate-scraper --format csv

**快速回答模式:**以 JSON 格式获取结果,选取前 5 条,并在聊天中以格式化形式呈现。

**保存到文件:**获取结果,然后使用 Write 工具保存为 YYYY-MM-DD_descriptive-name.csv 或 .json。

大型 / 长时间运行的抓取任务:

apify actors start "ACTOR_ID" --input-file input.json --user-agent apify-agent-skills/apify-ultimate-scraper --json 2>/dev/null

轮询:apify runs info RUN_ID --user-agent apify-agent-skills/apify-ultimate-scraper --json 2>/dev/null(检查 .status 是否为 SUCCEEDED)。

步骤 4:交付结果

报告结果数量、文件位置(如果已保存)、关键数据字段和链接:

  • 数据集:https://console.apify.com/storage/datasets/DATASET_ID
  • 运行:https://console.apify.com/actors/runs/RUN_ID

对于多步骤工作流:根据工作流指南建议下一步流程。

故障排除

常见错误和注意事项已记录在 references/gotchas.md 中。运行按事件付费(PPE)的 Actors 前,请先阅读。

评论

支持 Markdown