social-spark · 社交热评技能
抓取微博热评、知乎神答、全网热搜,为 AI 评论家提供真实社区声音。
适用场景:当用户要求查看"热搜榜"、"网友怎么说"、"知乎/微博在吵什么"、"AI圈动态"时触发。
数据源
| 平台 | 状态 | 说明 | |:---|:---|:---| | 知乎热榜 | ✅ 免费 | 无需 Key,直接调用 | | 微博热搜 | 🔑 需 Key | TianAPI,需自行申请免费 Key | | 全网热搜 | 🔑 需 Key | TianAPI,与微博热搜共用同一 Key |
快速开始
const { zhihuHotList, pickDebateTopic } = require('./social-spark.cjs');
// 抓取知乎热榜(免费,无需 Key)
const topics = await zhihuHotList(30);
const aiTopics = pickDebateTopic(topics);
console.log(aiTopics);
核心函数
zhihuHotList(limit?: number)
获取知乎热榜(免登录,free)
const { zhihuHotList } = require('./social-spark.cjs');
const topics = await zhihuHotList(30);
// 返回: [{ rank, title, url, question_id, heat, answer_count, follower_count, excerpt, platform }]
weiboHotList()
获取微博热搜榜(TianAPI Key needed)
const { weiboHotList } = require('./social-spark.cjs');
const topics = await weiboHotList();
// 返回: [{ rank, title, url, heat, label, platform }]
// 注意:需要配置 TianAPI Key,详见下方"配置"
networkHotList()
获取全网热搜榜(聚合微博/抖音/百度/知乎)
const { networkHotList } = require('./social-spark.cjs');
const topics = await networkHotList();
// 返回: [{ rank, title, digest, heat, url, platform }]
pickDebateTopic(topics, keywords?: string[])
从热榜中筛选适合辩论的 AI 相关话题
const { pickDebateTopic } = require('./social-spark.cjs');
const aiTopics = pickDebateTopic(topics);
// 筛选条件:热度≥50万 + 回答数≥10 + 关键词匹配
allPlatformHot(options?: object)
聚合多平台热搜,一次获取
const { allPlatformHot } = require('./social-spark.cjs');
const data = await allPlatformHot({
includeZhihu: true,
includeWeibo: true, // 需要 TianAPI Key
includeNetwork: true // 需要 TianAPI Key
});
// 返回: { zhihu: [], weibo: [], network: [], timestamp }
配置(必须)
TianAPI Key 申请
微博热搜和全网热搜需要 TianAPI 免费 Key:
- 访问 tianapi.com 注册账号
- 申请 微博热搜 API(ID: 100)和 全网热搜 API(ID: 223)
- 将 Key 填入
social-spark.cjs顶部的TIANAPI_KEY常量
// social-spark.cjs 第 13 行
const TIANAPI_KEY = '你的TianAPI免费Key'; // ← 替换这里
知乎热榜无需 Key,直接可用。
使用示例
// 获取今日 AI 相关热榜
const { allPlatformHot, pickDebateTopic } = require('./social-spark.cjs');
(async () => {
const data = await allPlatformHot({
includeZhihu: true,
includeWeibo: true,
includeNetwork: false // 节省配额可关闭
});
console.log('知乎 AI 话题:', data.zhihu.length + ' 条');
console.log('微博 AI 话题:', data.weibo.length + ' 条');
console.log('全网热搜:', data.network.length + ' 条');
// 获取最佳辩论候选
if (data.zhihu.length > 0) {
console.log('推荐话题:', data.zhihu[0].title);
}
})();
输出格式示例
// zhihuHotList 返回
{
rank: 1,
title: "Claude Tag发布意味着什么",
url: "https://www.zhihu.com/question/123456789",
question_id: "123456789",
heat: "103 万热度",
answer_count: 342,
follower_count: 12000,
excerpt: "Anthropic 最新发布的 Claude Tag 功能引发热议...",
platform: "知乎"
}
// pickDebateTopic 筛选结果
{
rank: 1,
title: "Claude Tag发布意味着什么",
heat: "103 万热度",
answer_count: 342,
excerpt: "...",
platform: "知乎"
}
路由触发词
当用户说以下内容时激活本技能:
- "热搜"、"微博热搜"、"知乎热榜"
- "网友怎么说"、"知乎/微博在吵什么"
- "AI圈有什么大事"、"今天AI圈动态"
- "帮我查一下全网热搜"
- "最近的辩论话题"、"有什么值得聊的AI话题"
注意事项
- 知乎 API 无需 Key,但有频率限制,避免 10 秒内连续调用超过 5 次
- TianAPI 免费配额:微博 100 次/天,全网热搜配额见官网
- 降级策略:微博/全网热搜 Key 未配置时,函数返回空数组,不报错
- 知乎回答 API(
zhihuAnswers)需要登录,调用失败时自动降级为热榜摘要
文件说明
SKILL.md— 本文件,技能说明social-spark.cjs— 核心技能代码(请从源码目录获取完整版本)icon.png— 技能图标
完整源码请到 GitHub 或联系作者获取。
Created by Worker-A · 2026-06-24 · For AI五星评论家 栏目
微信扫一扫