🥳加入无抓取社区领取您的免费试用,访问我们强大的网页抓取工具包!

Scrapeless x Pipedream

学习如何将 Scrapeless 与 Pipedream 集成,以构建可视化、自动化的无代码数据工作流程。

无需信用卡
Scrapeless x Pipedream

Pipedream 是一个强大的无服务器集成平台,允许开发者轻松连接数百个应用程序和 API,从而快速构建自动化工作流。用户可以使用 JavaScript、Python 和其他语言编写自定义逻辑,而无需管理任何基础设施。

它支持事件驱动架构,并与 Slack、Notion、GitHub 和 Stripe 等流行服务集成。Pipedream 特别适合构建 Webhook、数据同步、通知系统和其他自动化场景,显著提高开发效率和灵活性。

Scrapeless 在 Pipedream 中提供以下模块:

1. 爬虫

  • 爬虫抓取:从单个网页提取数据。
  • 爬虫爬取:爬取网站及其链接页面以提取全面数据。

2. 抓取 API

  • 轻松访问和获取 Google SERP 和 Google Trends 的丰富搜索数据。

3. 通用抓取 API

  • 访问受保护或动态页面。自动处理反抓取机制。
Scrapeless 与 pipedream 模块

如何创建知识图谱智能爬虫系统(Pipedream + Scrapeless)

前提条件

  • 您已在 Scrapeless 注册并获得 API 令牌。
  • 您拥有 Discord Webhook URL(用于发送通知)。

首先,您需要完成以下设置:

  1. Scrapeless API 密钥:请 注册 Scrapeless 帐户。注册后,您可以从仪表板访问您的 API 密钥。
Scrapeless API 密钥
  1. Pipedream 帐户:创建一个 Pipedream 帐户。

第 1 步:在 Pipedream 中设置您的 Scrapeless API 密钥

您需要登录到 Scrapeless 帐户并转到仪表板以获取您的 API 密钥。

获得后,转到 Pipedream 的“Accounts”选项卡,并在这里添加密钥,如下所示:

添加您的 scrapeless api 密钥

之后,将您的 API 密钥设置如下:

添加您的 scrapeless api 密钥

第 2 步:添加触发器 - schedule_trigger

  • 类型:计划
  • 触发时间:每天 08:00(UTC)
  • 方法:使用 Cron 或固定时间间隔
添加触发器

第 3 步:使用 Scrapeless 搜索特定关键字的知识面板信息

组件:

  • google-search

参数设置:

  • query: coffee
  • gl: us (可选)
  • hl: en (可选)
使用 Scrapeless 搜索特定关键字的知识面板信息

第 4 步:提取信息(extract_coffee_search_results

此步骤提取从上一步获得的关键字数据中的知识面板信息。

添加一个 Node.js 代码步骤,使用以下代码:

Copy
export default defineComponent({
  async run({ steps }) {
    const searchResult = steps.scrape_google?.$return_value;
    const webResults = searchResult?.knowledge_graph.web_results

    if (!searchResult || !webResults) {
      throw new Error("❌ No valid results returned from Scrapeless Google Search.");
    }

    const links = webResults.map((item) => item.link)

    return {
      links,
    };
  }
});

第 5 步:发送 Discord 通知(Send_Discord_Notification

此步骤将第 4 步获得的信息发送到您指定的 Discord 频道。

添加一个 Node.js 步骤,使用以下示例代码:

Copy
import { axios } from "@pipedream/platform";

export default defineComponent({
  async run({ steps, $ }) {
    const results = steps.extract_coffee_search_results.$return_value?.links || []
    console.log("result", results)
    const sendLinks = results.slice(0, 5)

    if (!sendLinks || sendLinks.length === 0) {
      console.log("✅ No search results to notify.");
      return { status: "no_results" };
    }

    const webhookUrl = "https://discord.com/api/webhooks/1381829187223949404/mweRKdQfJmA5OskoSZ0V_IApucOrMK7AHxN4YaAvjE3SRzp1xnbK4SFZLvMYjwnIFy1V"; // 🟡 请将其替换为您的 webhook

    const lines = sendLinks.map(r => `📌 ${r}`).join("\n\n");

    const message = {
      content: `📡 **关键字监控: "coffee"**\n\n${lines}\n\n⏰ 检测时间: ${new Date().toLocaleString()}`
    };

    try {
      const res = await axios($, {
        method: "POST",
        url: webhookUrl,
        headers: {
          "Content-Type": "application/json"
        },

数据:消息,
      });

      返回 { 状态: "已发送", res };
    } catch (err) {
      console.error("❌ Discord webhook 失败:", err);
      返回 { 状态: "错误", 错误: err.message };
    }
  },
});

将此行中的 URL 替换为您自己的 Discord Webhook:

Copy
const webhookUrl = "https://discord.com/api/webhooks/your_webhook_id/your_webhook_token";

如果您还没有 Webhook,您可以按照以下步骤在 Discord 中创建一个:

  1. 打开您想要发送通知的频道。
  2. 点击频道设置 > 集成 > Webhooks。
  3. 创建一个新的 Webhook,并复制其 URL,用作上面提到的 webhookUrl。

预览(消息已发送)

Jasper.ai 页面更改时,您将在 Discord 中收到如下消息:

预览(消息已发送)

在Scrapeless,我们仅访问公开可用的数据,并严格遵循适用的法律、法规和网站隐私政策。本博客中的内容仅供演示之用,不涉及任何非法或侵权活动。我们对使用本博客或第三方链接中的信息不做任何保证,并免除所有责任。在进行任何抓取活动之前,请咨询您的法律顾问,并审查目标网站的服务条款或获取必要的许可。

在本页上