
天天
简单说,Huginn 就是你的私人 IFTTT(If This Then That),一个可以在你自己服务器上运行的自动化工具。 不过相比 IFTTT,它更强大、更自由,当然也稍微有点技术门槛。
这个名字来自北欧神话,奥丁有两只乌鸦,其中一只叫 Huginn(代表"思想"),每天飞出去收集信息向主人汇报。
Huginn 的运作原理就像工厂流水线:每个 Agent(代理)就像流水线上的工人,负责一个特定任务。把多个 Agent 串联起来,就组成了一条完整的自动化流水线。
让我们来个完整的实战案例:监控多个技术博客,汇总后生成一个新的 RSS 源,你可以用任何 RSS 阅读器订阅。
应用打开后,默认账号密码是 admin/password。

登录 Huginn 后,点击 "Agents" → "New Agent"
选择 Agent 类型
Rss Agent监控猫哥的博客every_2h(每 2 小时检查一次)20(保留最近 20 条记录)
3. 配置 Options
{
"expected_update_period_in_days": "5",
"clean": "false",
"url": "https://manateelazycat.github.io/feed.xml"
}

4. 点击 "Dry Run" 测试

使用 Event Formatting Agent 为文章添加来源标签。
Event Formatting Agent
格式化文章数据
2. 配置 Options
{
"instructions": {
"title": "【猫哥博客】{{title}}",
"url": "{{url}}",
"description": "{{description}}",
"author": "{{author | default: 'ManateeLazyCat'}}",
"source": "ManateeLazyCat Blog",
"pubDate": "{{pubDate}}"
},
"mode": "clean",
"matchers": [],
"skip_created_at": "false"
}

创建更多 RSS Agent 监控其他博客:
监控阮一峰的博客:
{
"expected_update_period_in_days": "7",
"clean": "false",
"url": "http://www.ruanyifeng.com/blog/atom.xml"
}

监控 Hacker News:
{
"expected_update_period_in_days": "1",
"clean": "false",
"url": "https://news.ycombinator.com/rss"
}
为每个源创建对应的 Event Formatting Agent,添加不同的标签。
Digest Agent汇总所有文章

2. 配置 Options
{
"expected_update_period_in_days": "1",
"message": "{% for event in events %}\n<item>\n <title>{{ event.title | xml_escape }}</title>\n <link>{{ event.url | xml_escape }}</link>\n <description>{{ event.description | xml_escape }}</description>\n <pubDate>{{ event.pubDate }}</pubDate>\n <source>{{ event.source }}</source>\n</item>\n{% endfor %}",
"retained_events": "100"
}
Data Output Agent输出RSS源
2. 配置 Options
{
"secrets": ["my_secret_token"],
"expected_receive_period_in_days": "2",
"template": {
"title": "我的技术资讯聚合",
"description": "聚合多个技术博客的 RSS",
"link": "https://huginn.懒猫.heiyu.space/",
"item": {
"title": "{{title}}",
"description": "{{description}}",
"link": "{{url}}",
"pubDate": "{{pubDate}}",
"guid": "{{url}}"
}
},
"events_to_show": "50",
"response_headers": {
"Content-Type": "application/rss+xml; charset=utf-8"
}
}
http://你的域名/users/1/web_requests/xxx/my_secret_token.xml
监控博客RSS (Rss Agent) → 格式化数据 (Event Formatting Agent) →
↓
监控其他RSS (Rss Agent) → 格式化数据 (Event Formatting Agent) →
汇总 (Digest Agent)
↓
输出RSS (Data Output Agent)
↓
你的RSS阅读器订阅
配置完成后:
这样你就有了一个完全由自己控制的技术资讯聚合器。
Huginn 确实需要一点技术基础,刚开始可能会觉得有点复杂,但当你成功设置第一个自动化任务,看到它默默为你工作时,那种成就感真的很棒。而且一旦上手,你会发现越来越多的使用场景,生活和工作效率都会大大提升。
祝你玩得开心,让 Huginn 成为你的数字生活小助手!
相关资源:
评论
0暂无评论