api-config.json 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. {
  2. "name": "douyin-hashtag-search",
  3. "displayName": "抖音话题搜索 V2",
  4. "description": "按关键词搜索抖音话题(挑战/#标签),返回话题浏览量、参与人数、话题描述等。适用于品类话题热度分析、竞品话题监控、内容营销切入点发现。",
  5. "category": "douyin",
  6. "version": "1.3.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/voc-social/douyin/search/fetch_challenge_search_v2",
  10. "headers": {
  11. "Authorization": "Bearer ${vocToken}",
  12. "Content-Type": "application/json",
  13. "Accept": "application/json"
  14. }
  15. },
  16. "parameters": {
  17. "type": "object",
  18. "required": [
  19. "keyword"
  20. ],
  21. "properties": {
  22. "keyword": {
  23. "type": "string",
  24. "description": "搜索关键词,如 '游戏'、'美食'"
  25. },
  26. "cursor": {
  27. "type": "integer",
  28. "description": "翻页游标,首次请求传 0",
  29. "default": 0
  30. },
  31. "sort_type": {
  32. "type": "string",
  33. "description": "排序方式:'0'=综合排序;'1'=最多点赞(爆款话题);'2'=最新发布(新兴话题)",
  34. "enum": [
  35. "0",
  36. "1",
  37. "2"
  38. ],
  39. "default": "0"
  40. },
  41. "publish_time": {
  42. "type": "string",
  43. "description": "发布时间范围:'0'=不限;'1'=最近一天;'7'=最近一周;'180'=最近半年",
  44. "enum": [
  45. "0",
  46. "1",
  47. "7",
  48. "180"
  49. ],
  50. "default": "0"
  51. },
  52. "filter_duration": {
  53. "type": "string",
  54. "description": "视频时长:'0'=不限;'0-1'=1分钟以内;'1-5'=1-5分钟;'5-10000'=5分钟以上",
  55. "enum": [
  56. "0",
  57. "0-1",
  58. "1-5",
  59. "5-10000"
  60. ],
  61. "default": "0"
  62. },
  63. "content_type": {
  64. "type": "string",
  65. "description": "内容类型:'0'=不限;'1'=视频;'2'=图文/图片;'3'=文章",
  66. "enum": [
  67. "0",
  68. "1",
  69. "2",
  70. "3"
  71. ],
  72. "default": "0"
  73. },
  74. "search_id": {
  75. "type": "string",
  76. "description": "搜索ID,首次请求传空,翻页时使用上次返回值",
  77. "default": ""
  78. }
  79. }
  80. },
  81. "requestTransform": {
  82. "body": {
  83. "keyword": "{{keyword}}",
  84. "cursor": "{{cursor}}",
  85. "sort_type": "{{sort_type}}",
  86. "publish_time": "{{publish_time}}",
  87. "filter_duration": "{{filter_duration}}",
  88. "content_type": "{{content_type}}",
  89. "search_id": "{{search_id}}"
  90. }
  91. },
  92. "response": {
  93. "type": "object",
  94. "description": "话题搜索结果(双层包装:{code, data},话题在 data.business_data 内)",
  95. "note": "顶层 {code:200, data:{...}},data 内 business_data[] 是话题卡片列表,每张卡片的话题数据在 business_data[].data.challenge_info 内。",
  96. "properties": {
  97. "code": {
  98. "type": "integer",
  99. "description": "HTTP 状态码(200=成功)"
  100. },
  101. "data": {
  102. "type": "object",
  103. "description": "业务数据包装层",
  104. "properties": {
  105. "business_data": {
  106. "type": "array",
  107. "description": "话题卡片列表,每项含 type / card_id / data。话题数据在 data.challenge_info 内"
  108. },
  109. "extra": {
  110. "type": "object",
  111. "description": "翻页及日志信息"
  112. }
  113. }
  114. }
  115. },
  116. "keyFields": {
  117. "data.business_data[].data.challenge_info.cid": "话题 ID",
  118. "data.business_data[].data.challenge_info.cha_name": "话题名称",
  119. "data.business_data[].data.challenge_info.desc": "话题描述",
  120. "data.business_data[].data.challenge_info.user_count": "参与人数",
  121. "data.business_data[].data.challenge_info.view_count": "浏览量"
  122. }
  123. },
  124. "usageExamples": [
  125. {
  126. "name": "品类话题热度排名",
  127. "input": {
  128. "keyword": "香薰蜡烛",
  129. "cursor": 0,
  130. "sort_type": "1"
  131. },
  132. "description": "搜索香薰蜡烛相关话题,按浏览量排名,分析平台热门话题与流量入口"
  133. },
  134. {
  135. "name": "新兴话题发现",
  136. "input": {
  137. "keyword": "露营神器",
  138. "cursor": 0,
  139. "sort_type": "2",
  140. "publish_time": "7"
  141. },
  142. "description": "搜索最新白应话题,判断新兴趋势方向及内容营销切入机会"
  143. },
  144. {
  145. "name": "竞品品牌话题监控",
  146. "input": {
  147. "keyword": "竞品品牌名或标志性话题",
  148. "cursor": 0,
  149. "sort_type": "0"
  150. },
  151. "description": "搜索竞品相关话题,了解其话题流量规模和平台曝光程度"
  152. }
  153. ],
  154. "workflow": {
  155. "description": "推荐调用链",
  156. "steps": [
  157. "本步: douyin-hashtag-search(keyword) → 获取话题列表 → 得到 cha_name、view_count、user_count",
  158. "分析: 按 view_count 排序找到最大流量话题,评估内容营销切入横杆价値",
  159. "下游: 使用 douyin-general-search(话题名) 获取话题下的具体视频内容"
  160. ]
  161. },
  162. "reportMapping": {
  163. "slides": [
  164. "社媒聆听(Slide14)"
  165. ],
  166. "dataPoints": [
  167. "品类话题热度排名",
  168. "话题浏览量与参与人数(规模评估)",
  169. "新兴趋势话题发现",
  170. "竞品话题曝光对比"
  171. ]
  172. },
  173. "timeout": 60000,
  174. "retry": {
  175. "maxAttempts": 3,
  176. "delay": 1500,
  177. "backoffMultiplier": 2
  178. },
  179. "tokenConfig": {
  180. "type": "bearer",
  181. "configFile": "~/.openclaw/voc-credentials.json",
  182. "tokenField": "vocToken",
  183. "resolutionOrder": [
  184. "configFile"
  185. ],
  186. "apigId": "Vo3ROWEvDy",
  187. "paymentUrlResolution": {
  188. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  189. "steps": [
  190. "1. 从 voc-credentials.json 获取当前 session token",
  191. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  192. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  193. "4. 将该URL展示给用户,引导扫码支付"
  194. ],
  195. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  196. "userResolveHeaders": {
  197. "X-Parse-Application-Id": "ncloudmaster",
  198. "X-Parse-Session-Token": "{vocToken}"
  199. },
  200. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  201. "paymentParams": {
  202. "user": "{resolvedUserId}",
  203. "apigid": "Vo3ROWEvDy",
  204. "fun_id": "HOkkX72PMF"
  205. },
  206. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  207. },
  208. "onMissing": {
  209. "action": "showPaymentQR",
  210. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  211. "title": "扫码开通 VOC-AI 数据服务",
  212. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  213. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  214. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  215. },
  216. "onBalanceInsufficient": {
  217. "action": "resolveUserThenShowPayment",
  218. "title": "VOC-AI Token 余额不足,请扫码充值",
  219. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  220. }
  221. },
  222. "errorHandling": {
  223. "balanceInsufficient": {
  224. "conditions": [
  225. {
  226. "responseField": "code",
  227. "operator": "in",
  228. "value": [
  229. -2,
  230. -3,
  231. -10,
  232. 402,
  233. 429
  234. ]
  235. },
  236. {
  237. "responseField": "msg",
  238. "operator": "contains",
  239. "value": [
  240. "余额不足",
  241. "insufficient",
  242. "balance",
  243. "quota",
  244. "没有开通",
  245. "权限或余额"
  246. ]
  247. },
  248. {
  249. "responseField": "mess",
  250. "operator": "contains",
  251. "value": [
  252. "余额不足",
  253. "insufficient",
  254. "balance",
  255. "quota",
  256. "没有开通",
  257. "权限或余额"
  258. ]
  259. },
  260. {
  261. "responseField": "message",
  262. "operator": "contains",
  263. "value": [
  264. "余额不足",
  265. "insufficient",
  266. "balance",
  267. "没有开通",
  268. "权限或余额"
  269. ]
  270. }
  271. ],
  272. "matchMode": "any",
  273. "trigger": "tokenConfig.onBalanceInsufficient"
  274. },
  275. "unauthorized": {
  276. "conditions": [
  277. {
  278. "responseField": "code",
  279. "operator": "in",
  280. "value": [
  281. 401,
  282. 403
  283. ]
  284. },
  285. {
  286. "responseField": "msg",
  287. "operator": "contains",
  288. "value": [
  289. "unauthorized",
  290. "token",
  291. "invalid",
  292. "auth"
  293. ]
  294. }
  295. ],
  296. "matchMode": "any",
  297. "trigger": "tokenConfig.onMissing"
  298. }
  299. }
  300. }