api-config.json 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. {
  2. "name": "douyin-video-comments",
  3. "displayName": "抖音视频评论查询",
  4. "description": "获取抖音视频的用户评论列表,支持翻页。直接反映用户对产品/内容的真实评价,是VOC情感分析、痛点挖掘、需求发现的核心数据源。",
  5. "category": "douyin",
  6. "version": "1.3.0",
  7. "endpoint": {
  8. "method": "GET",
  9. "url": "https://server.fmode.cn/api/voc-social/douyin/app/v3/fetch_video_comments",
  10. "headers": {
  11. "Authorization": "Bearer ${vocToken}",
  12. "Accept": "application/json"
  13. }
  14. },
  15. "parameters": {
  16. "type": "object",
  17. "required": [
  18. "aweme_id"
  19. ],
  20. "properties": {
  21. "aweme_id": {
  22. "type": "string",
  23. "description": "抖音作品 ID"
  24. },
  25. "cursor": {
  26. "type": "integer",
  27. "description": "分页游标,首次传 0,后续使用上次返回的 cursor 值",
  28. "default": 0
  29. },
  30. "count": {
  31. "type": "integer",
  32. "description": "每页数量,请保持默认值 20",
  33. "default": 20
  34. }
  35. }
  36. },
  37. "requestTransform": {
  38. "queryParams": {
  39. "aweme_id": "{{aweme_id}}",
  40. "cursor": "{{cursor}}",
  41. "count": "{{count}}"
  42. }
  43. },
  44. "response": {
  45. "type": "object",
  46. "description": "评论数据(双层包装:{code, data},评论在 data 内)",
  47. "note": "顶层 {code:200, data:{...}},评论列表、翻页、总数均在 data 内。",
  48. "properties": {
  49. "code": {
  50. "type": "integer",
  51. "description": "HTTP 状态码(200=成功)"
  52. },
  53. "data": {
  54. "type": "object",
  55. "description": "业务数据包装层",
  56. "properties": {
  57. "comments": {
  58. "type": "array",
  59. "description": "评论列表,每项含 text(评论正文)、user(评论者)、digg_count(点赞)、reply_comment_total(回复数)、create_time 等"
  60. },
  61. "has_more": {
  62. "type": "integer",
  63. "description": "是否有更多评论(1=有,0=无)"
  64. },
  65. "cursor": {
  66. "type": "integer",
  67. "description": "下一页游标,翻页时作为 cursor 参数传入"
  68. },
  69. "total": {
  70. "type": "integer",
  71. "description": "评论总数"
  72. }
  73. }
  74. }
  75. },
  76. "keyFields": {
  77. "data.comments[].text": "评论正文(VOC 核心数据)",
  78. "data.comments[].user.nickname": "评论者昵称",
  79. "data.comments[].user.uid": "评论者 ID",
  80. "data.comments[].digg_count": "评论获赞数(高赞=共识)",
  81. "data.comments[].reply_comment_total": "回复数,可用 douyin-comment-replies 获取",
  82. "data.comments[].create_time": "评论时间戳(秒)",
  83. "data.comments[].ip_label": "评论 IP 地域",
  84. "data.has_more": "翻页终止条件",
  85. "data.cursor": "下一页游标",
  86. "data.total": "评论总数"
  87. }
  88. },
  89. "usageExamples": [
  90. {
  91. "name": "爆款视频用户声音采集",
  92. "input": {
  93. "aweme_id": "7448118827402972455",
  94. "cursor": 0,
  95. "count": 20
  96. },
  97. "description": "获取爆款视频前20条评论,提取用户对产品的真实评价和购买意愿"
  98. },
  99. {
  100. "name": "翻页采集更多评论",
  101. "input": {
  102. "aweme_id": "7448118827402972455",
  103. "cursor": 20,
  104. "count": 20
  105. },
  106. "description": "使用上次返回的 cursor 值翻页,累计采集更多用户评论"
  107. }
  108. ],
  109. "workflow": {
  110. "description": "推荐调用链",
  111. "steps": [
  112. "上游: douyin-general-search(keyword, sort_type='1') → 找到高点赞爆款视频",
  113. "上游: douyin-video-detail(aweme_id) → 确认视频互动数据",
  114. "本步: douyin-video-comments(aweme_id) → 批量采集用户评论",
  115. "下游: douyin-comment-replies(item_id, comment_id) → 获取热评下的回复"
  116. ]
  117. },
  118. "reportMapping": {
  119. "slides": [
  120. "社媒聆听(Slide14)"
  121. ],
  122. "dataPoints": [
  123. "用户痛点关键词",
  124. "正向/负向情感分布",
  125. "高频需求词提取",
  126. "评论点赞数(热评识别)",
  127. "用户购买意向信号"
  128. ]
  129. },
  130. "timeout": 60000,
  131. "retry": {
  132. "maxAttempts": 3,
  133. "delay": 1500,
  134. "backoffMultiplier": 2
  135. },
  136. "tokenConfig": {
  137. "type": "bearer",
  138. "configFile": "~/.openclaw/voc-credentials.json",
  139. "tokenField": "vocToken",
  140. "resolutionOrder": [
  141. "configFile"
  142. ],
  143. "apigId": "Vo3ROWEvDy",
  144. "paymentUrlResolution": {
  145. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  146. "steps": [
  147. "1. 从 voc-credentials.json 获取当前 session token",
  148. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  149. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  150. "4. 将该URL展示给用户,引导扫码支付"
  151. ],
  152. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  153. "userResolveHeaders": {
  154. "X-Parse-Application-Id": "ncloudmaster",
  155. "X-Parse-Session-Token": "{vocToken}"
  156. },
  157. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  158. "paymentParams": {
  159. "user": "{resolvedUserId}",
  160. "apigid": "Vo3ROWEvDy",
  161. "fun_id": "HOkkX72PMF"
  162. },
  163. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  164. },
  165. "onMissing": {
  166. "action": "showPaymentQR",
  167. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  168. "title": "扫码开通 VOC-AI 数据服务",
  169. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  170. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  171. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  172. },
  173. "onBalanceInsufficient": {
  174. "action": "resolveUserThenShowPayment",
  175. "title": "VOC-AI Token 余额不足,请扫码充值",
  176. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  177. }
  178. },
  179. "errorHandling": {
  180. "balanceInsufficient": {
  181. "conditions": [
  182. {
  183. "responseField": "code",
  184. "operator": "in",
  185. "value": [
  186. -2,
  187. -3,
  188. -10,
  189. 402,
  190. 429
  191. ]
  192. },
  193. {
  194. "responseField": "msg",
  195. "operator": "contains",
  196. "value": [
  197. "余额不足",
  198. "insufficient",
  199. "balance",
  200. "quota",
  201. "没有开通",
  202. "权限或余额"
  203. ]
  204. },
  205. {
  206. "responseField": "mess",
  207. "operator": "contains",
  208. "value": [
  209. "余额不足",
  210. "insufficient",
  211. "balance",
  212. "quota",
  213. "没有开通",
  214. "权限或余额"
  215. ]
  216. },
  217. {
  218. "responseField": "message",
  219. "operator": "contains",
  220. "value": [
  221. "余额不足",
  222. "insufficient",
  223. "balance",
  224. "没有开通",
  225. "权限或余额"
  226. ]
  227. }
  228. ],
  229. "matchMode": "any",
  230. "trigger": "tokenConfig.onBalanceInsufficient"
  231. },
  232. "unauthorized": {
  233. "conditions": [
  234. {
  235. "responseField": "code",
  236. "operator": "in",
  237. "value": [
  238. 401,
  239. 403
  240. ]
  241. },
  242. {
  243. "responseField": "msg",
  244. "operator": "contains",
  245. "value": [
  246. "unauthorized",
  247. "token",
  248. "invalid",
  249. "auth"
  250. ]
  251. }
  252. ],
  253. "matchMode": "any",
  254. "trigger": "tokenConfig.onMissing"
  255. }
  256. }
  257. }