跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.anysite.io/llms.txt

Use this file to discover all available pages before exploring further.

概述

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

节点配置

认证

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

可用操作

在所有子版块或特定社区中搜索 Reddit 帖子。参数:
  • Query(必填):用于查找帖子的搜索词
  • Subreddit:要搜索的特定子版块(可选)
  • Sort:“relevance”、“hot”、“new”、“top”
  • Time Range:“hour”、“day”、“week”、“month”、“year”、“all”
  • Limit:返回的最大结果数(1-100)
输出示例:
{
  "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/"
    }
  ]
}

工作流示例

品牌监控

1

监控提及

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

分析情感

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

跟踪互动

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

提醒团队

为高影响力提及或负面情感发送通知。
工作流示例:
{
  "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解决方案:
  • 在请求之间添加延迟(推荐:2-3 秒)
  • 实现指数退避重试逻辑
  • 考虑升级 API 计划以获得更高限制

健壮的错误处理

{
  "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)) }}"
}

后续步骤