使用 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 }}"
}
}
]
}
研究客户意见和市场趋势:
监控并与您的社区互动:
使用 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"
}
}
为重要讨论发送提醒:
{
"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)) }}"
}