npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@loopsaaage/n8n-nodes-smart-crawler

v0.1.0

Published

通用智能爬虫n8n节点,使用Axios + Cheerio,支持多跳数据提取

Readme

n8n-nodes-smart-crawler

npm version

通用智能爬虫 n8n 节点,使用 Axios + Cheerio 实现,支持灵活的页面数据提取和多跳数据采集。

功能特性

  • 🎯 灵活的选择器配置:使用 CSS 选择器精确定位页面元素
  • 📦 多字段提取:支持同时提取多个字段,包括文本、HTML、属性值
  • 🔗 多跳支持:最多支持 3 跳跳转,深度提取嵌套页面数据
  • 🍪 Cookie 支持:支持配置 Cookie 访问需要登录的页面
  • ⚙️ 预设字段:提供常用的字段提取配置选项
  • 🔄 自动 URL 解析:自动处理相对路径和绝对路径 URL

快速开始

安装

在 n8n 中安装此节点:

npm install n8n-nodes-smart-crawler

然后在 n8n 设置中刷新节点,即可在节点面板中使用。

基础使用

  1. 添加 Smart Crawler 节点到工作流
  2. 配置以下参数:
    • 页面链接:要爬取的页面 URL
    • Cookie:(可选)访问需要登录的页面时设置
    • 列表选择器:选择数据列表的 CSS 选择器
  3. 添加字段配置:
    • 字段名称:输出数据的字段名
    • 选择器:CSS 选择器定位元素
    • 提取类型:文本内容 / HTML 内容 / 属性值
    • 属性名:(当类型为属性值时)指定属性名
  4. 执行工作流,提取数据

配置说明

列表选择器

指定包含多个数据项的容器选择器。例如:

  • .product-item - 选择所有 class 为 product-item 的元素
  • .news-list > li - 选择列表中的所有列表项
  • div[data-type="item"] - 选择具有特定属性的元素

字段配置

每个字段配置项可以提取列表项中的特定数据。

提取类型

  • 文本内容:提取元素的文本内容(去除空白)
  • HTML 内容:提取元素的 HTML 代码
  • 属性值:提取元素的指定属性值

多跳配置

对于需要跳转到其他页面提取的字段,可以启用跳转配置。

跳转配置结构

每跳包含以下配置:

  • 点击元素选择器:用于获取跳转链接的元素
  • 目标页面数据选择器:(可选)跳转后页面的数据容器选择器
  • 字段:在跳转页面要提取的字段列表

跳转层级

  • 第一跳:从列表项跳转到详情页
  • 第二跳:从详情页跳转到相关页面
  • 第三跳:继续深入跳转

使用示例

示例 1:提取新闻列表

页面链接:https://news.example.com
列表选择器:.news-item
字段:
  - 字段名称:title
    选择器:.title
    提取类型:文本内容
  - 字段名称:link
    选择器:a.read-more
    提取类型:属性值
    属性名:href

示例 2:多跳提取商品详情

页面链接:https://shop.example.com/products
列表选择器:.product-card
字段:
  - 字段名称:productName
    选择器:h3.name
    提取类型:文本内容
  - 字段名称:details
    选择器:a.detail-link
    是否为跳转字段:是
    跳转配置(第一跳):
      点击元素选择器:a
      字段:
        - 字段名称:price
          选择器:.price
          提取类型:文本内容
        - 字段名称:description
          选择器:.description
          提取类型:HTML 内容

开发

本地开发

# 安装依赖
npm install

# 启动开发服务器
npm run dev

# 构建
npm run build

# 代码检查
npm run lint
npm run lint:fix

发布

# 构建项目
npm run build

# 发布到 npm
npm publish

技术栈

  • Axios - HTTP 请求库
  • Cheerio - 快速的 HTML/XML 解析器

许可证

MIT

贡献

欢迎提交 Issue 和 Pull Request!

链接