快手(中国)
快手话题信息流 API
读取快手(中国)某个话题下的内容:每页 20 条帖子,包括文案、作者、播放 / 点赞 / 评论 / 分享 / 收藏数和封面图,外加话题本身的累计播放量,以 JSON 返回。每页消耗 1 积分,只有搜索接口的十分之一,是挖掘趋势或长期跟踪活动话题的低成本方式。采用游标分页。
POST/api/v1/kuaishou/tag/feed
Authorizations
AuthorizationstringheaderrequiredBearer authentication header of the form Bearer <token>, where <token> is your Scavio API key (e.g. Bearer sk_live_your_key).
Body
application/jsontagstringrequired话题文字,1 到 200 个字符,不要带开头的 #:传 挑战,而不是 #挑战。快手是中文平台,中文话题的内容量最大。快手会把文字解析为自己的话题 id,并在 tagInfo 中同时返回两者,方便你确认实际命中的是哪个话题。
Example: 挑战
cursorstring不透明的分页游标(cursor)。第一页不传,之后传入上一次响应中的 pcursor 值。响应字段名是 pcursor,不是 next_cursor。pcursor 为 "no_more" 表示没有更多页。
Example: 1
Request
from scavio import ScavioClient
client = ScavioClient(api_key="sk_live_your_key")
# 每页 1 积分,挖掘趋势最便宜的方式。
cursor, rows = None, []
while len(rows) < 200:
page = client.kuaishou.tag_feed(tag="挑战", cursor=cursor)
info = page["data"].get("tagInfo", {})
print("tag:", info.get("name"), info.get("tagId"), info.get("viewCount"))
for item in page["data"].get("mixFeeds", []):
if item.get("itemType") != 5: # 跳过非视频卡片
continue
feed = item["feed"]
rows.append((feed["caption"], feed["view_count"], feed["share_info"]))
cursor = page["data"].get("pcursor") # 不是 next_cursor
if not cursor or cursor == "no_more":
breakResponse
"result": 1,
"pcursor": "1",
"llsid": 2006155281048684500
},
"response_time": 2837,
"credits_used": 1,
"credits_remaining": 4732
}