Reddit 节点

使用 Anysite Reddit 节点在 n8n 工作流中提取 Reddit 数据

概述

Anysite Reddit 节点允许您在 n8n 工作流中从 Reddit 提取有价值的数据。搜索帖子、监控子版块、分析讨论并跟踪社区情感。

节点配置

认证

从下拉菜单中选择您的 Anysite API 凭证,或创建新凭证。

可用操作

搜索帖子

在所有子版块或特定社区中搜索 Reddit 帖子。

参数:

输出示例:

{
  "posts": [
    {
      "id": "post123",
      "title": "How to build scalable web applications",
      "text": "Here's what I learned after building 10+ web apps...",
      "subreddit": "webdev",
      "author": "experienced_dev",
      "score": 245,
      "upvoteRatio": 0.92,
      "comments": 67,
      "created": "2024-08-26T10:30:00Z",
      "url": "https://reddit.com/r/webdev/comments/abc123/"
    }
  ]
}

获取帖子评论

从特定 Reddit 帖子提取评论和讨论线程。

参数:

输出示例:

{
  "comments": [
    {
      "id": "comment456",
      "text": "Great points! I'd also add that caching is crucial...",
      "author": "cache_expert",
      "score": 89,
      "created": "2024-08-26T11:15:00Z",
      "replies": [
        {
          "id": "reply789",
          "text": "Absolutely! Redis has been a game changer for us.",
          "author": "redis_fan",
          "score": 34
        }
      ]
    }
  ]
}

获取子版块信息

获取特定子版块的信息和统计数据。

参数:

输出示例:

{
  "subreddit": {
    "name": "MachineLearning",
    "title": "Machine Learning",
    "description": "This subreddit is dedicated to the discussion of machine learning...",
    "subscribers": 2500000,
    "activeUsers": 5420,
    "created": "2008-01-25T12:00:00Z",
    "isNsfw": false,
    "rules": [
      {
        "title": "Stay on topic",
        "description": "Posts must be related to machine learning"
      }
    ]
  }
}

监控热门帖子

获取指定子版块当前的热门/trending 帖子。

参数:

输出示例:

{
  "hotPosts": [
    {
      "subreddit": "technology",
      "title": "New AI breakthrough announced by researchers",
      "score": 8750,
      "comments": 432,
      "trending": true,
      "hotnessRank": 1
    }
  ]
}

工作流示例

品牌监控

监控提及

在相关子版块中搜索提及您的品牌、产品或竞争对手的帖子。

分析情感

使用 AI 节点分析情感,识别正面/负面讨论。

跟踪互动

监控围绕您品牌的赞数、评论和讨论活动。

提醒团队

为高影响力提及或负面情感发送通知。

工作流示例:

{
  "nodes": [
    {
      "name": "Monitor Brand Mentions",
      "type": "@horizondatawave/n8n-nodes-anysite.Reddit",
      "operation": "searchPosts",
      "parameters": {
        "query": "YourBrand OR YourProduct",
        "subreddit": "technology,startups,entrepreneur",
        "sort": "new",
        "limit": 50
      }
    },
    {
      "name": "Filter High Engagement",
      "type": "n8n-nodes-base.filter",
      "parameters": {
        "conditions": [
          {
            "field": "score",
            "operation": "greaterThan",
            "value": 10
          },
          {
            "field": "comments",
            "operation": "greaterThan",
            "value": 5
          }
        ]
      }
    },
    {
      "name": "Get Comments",
      "type": "@horizondatawave/n8n-nodes-anysite.Reddit",
      "operation": "getPostComments",
      "parameters": {
        "postUrl": "={{ $json.url }}",
        "commentDepth": 2,
        "limit": 25
      }
    },
    {
      "name": "Analyze Sentiment",
      "type": "n8n-nodes-base.openAi",
      "parameters": {
        "prompt": "Analyze sentiment of this Reddit discussion: {{ $json.title }} - {{ $json.text }}"
      }
    }
  ]
}

市场研究

研究客户意见和市场趋势:

  1. 行业监控 - 跟踪行业特定子版块中的讨论
  2. 产品反馈 - 查找提及您产品或竞争对手的帖子
  3. 功能需求 - 识别常见的功能请求或痛点
  4. 趋势分析 - 分析热门话题和新兴技术
  5. 报告生成 - 创建每周市场研究报告

社区管理

监控并与您的社区互动:

  1. 支持问题 - 找到寻求产品帮助的用户
  2. Bug 报告 - 识别和跟踪用户的 Bug 报告
  3. 功能讨论 - 监控关于新功能的讨论
  4. 社区健康 - 跟踪您子版块中的情感和互动
  5. 审核提醒 - 获取需要关注的帖子通知

高级搜索

搜索运算符

使用 Reddit 的搜索语法进行精确查询:

// 精确标题匹配
{
  "query": "title:\"How to learn machine learning\""
}

// 作者搜索
{
  "query": "author:specific_username"
}

// 多个子版块
{
  "query": "subreddit:MachineLearning OR subreddit:programming"
}

// URL 搜索
{
  "query": "url:github.com"
}

// 标签搜索
{
  "query": "flair:Discussion"
}

// 仅自发帖子
{
  "query": "self:yes machine learning tutorial"
}

// 分数筛选
{
  "query": "score:>100 artificial intelligence"
}

基于时间的分析

跟踪一段时间内的讨论:

{
  "name": "Weekly Trend Analysis",
  "type": "@horizondatawave/n8n-nodes-anysite.Reddit",
  "operation": "searchPosts",
  "parameters": {
    "query": "artificial intelligence",
    "subreddit": "MachineLearning",
    "sort": "top",
    "timeRange": "week",
    "limit": 100
  }
}

数据分析

互动指标

计算帖子和评论的互动:

// 互动率计算
{
  "engagementRate": "={{ ($json.comments / ($json.score || 1)) * 100 }}"
}

// 争议分数
{
  "controversyScore": "={{ (1 - $json.upvoteRatio) * 100 }}"
}

// 讨论密度
{
  "discussionDensity": "={{ $json.comments / Math.max($json.text.length / 100, 1) }}"
}

内容分析

从 Reddit 内容中提取洞察:

{
  "name": "Extract Keywords",
  "type": "n8n-nodes-base.function",
  "parameters": {
    "functionCode": `
      const text = $input.first().json.text.toLowerCase();
      const keywords = text.match(/\\b\\w{4,}\\b/g) || [];
      const wordCount = {};

      keywords.forEach(word => {
        wordCount[word] = (wordCount[word] || 0) + 1;
      });

      const topKeywords = Object.entries(wordCount)
        .sort(([,a], [,b]) => b - a)
        .slice(0, 10)
        .map(([word, count]) => ({ word, count }));

      return [{ json: { ...item.json, topKeywords } }];
    `
  }
}

错误处理

常见错误

子版块未找到

错误: 404 - Subreddit not found

解决方案:

帖子已删除

错误: 404 - Post not found

解决方案:

达到速率限制

错误: 429 - Too many requests

解决方案:

健壮的错误处理

{
  "name": "Reddit with Error Handling",
  "type": "@horizondatawave/n8n-nodes-anysite.Reddit",
  "continueOnFail": true,
  "retryOnFail": true,
  "maxTries": 3,
  "waitBetweenTries": 3000,
  "parameters": {
    "operation": "searchPosts",
    "query": "your search query"
  }
}

集成示例

Slack 通知

为重要讨论发送提醒:

{
  "name": "High-Impact Alert",
  "type": "n8n-nodes-base.slack",
  "parameters": {
    "channel": "#marketing",
    "text": "🔥 Trending Reddit post about {{ $json.title }}\n📊 Score: {{ $json.score }} | 💬 Comments: {{ $json.comments }}\n🔗 {{ $json.url }}"
  }
}

数据库存储

存储 Reddit 数据以供分析:

{
  "name": "Store in Database",
  "type": "n8n-nodes-base.postgres",
  "parameters": {
    "operation": "insert",
    "table": "reddit_posts",
    "columns": [
      "post_id",
      "title",
      "subreddit",
      "score",
      "comments",
      "created_at"
    ],
    "values": [
      "={{ $json.id }}",
      "={{ $json.title }}",
      "={{ $json.subreddit }}",
      "={{ $json.score }}",
      "={{ $json.comments }}",
      "={{ $json.created }}"
    ]
  }
}

内容聚合

将 Reddit 数据与其他来源结合:

{
  "workflow": [
    "Reddit Search → Get Hot Posts",
    "Twitter Search → Find Related Tweets",
    "Google News → Get News Articles",
    "AI Analysis → Extract Common Themes",
    "Report Generation → Create Daily Brief"
  ]
}

性能技巧

高效的批量操作

{
  "name": "Batch Subreddit Monitor",
  "type": "n8n-nodes-base.splitInBatches",
  "parameters": {
    "batchSize": 5,
    "options": {
      "reset": false
    }
  }
}

数据去重

删除重复帖子:

// 按帖子 ID 去重
{
  "name": "Remove Duplicates",
  "type": "n8n-nodes-base.removeDuplicates",
  "parameters": {
    "compare": "selectedFields",
    "fieldsToCompare": ["id"]
  }
}

社区洞察

子版块分析

分析子版块健康状况和趋势:

{
  "name": "Subreddit Health Check",
  "type": "@horizondatawave/n8n-nodes-anysite.Reddit",
  "operation": "getSubredditInfo",
  "parameters": {
    "subredditName": "{{ $json.subreddit }}",
    "includeRules": true,
    "includeModerators": false
  }
}

讨论质量

评估讨论质量指标:

// 计算讨论质量分数
{
  "qualityScore": "={{ (($json.score * 0.4) + ($json.comments * 0.3) + (($json.upvoteRatio - 0.5) * 200 * 0.3)) }}"
}

后续步骤