快手(中国)
快手视频搜索 API
按关键词搜索快手(中国)视频,每页 20 条排序结果:文案、作者、播放 / 点赞 / 评论 / 分享 / 收藏数、时长、发布时间和封面图,以 JSON 返回,不夹杂推广卡片或用户结果。每页消耗 10 积分;快手按接口计费(1、2、10 或 40 积分),四个搜索接口都是 10 积分。采用游标分页,价格与综合搜索接口相同,速度快约八倍。
POST/api/v1/kuaishou/search/videos
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/jsonkeywordstringrequired搜索关键词,1 到 200 个字符。快手是中文平台:中文关键词能检索到完整内容,拉丁字母关键词只返回快手自己匹配到的结果,通常少得多。话题文字可以作为普通关键词使用,但读取话题的专用方式是话题信息流接口,只需 1 积分。
Example: 人工智能
cursorstring不透明的分页游标(cursor)。第一页不传,之后传入上一次响应中的 pcursor 值。响应字段名是 pcursor,不是 next_cursor。不要传 recoPcursor,那是快手推荐流的另一个游标。pcursor 为 "no_more" 表示没有更多页。
Example: 1
Request
from scavio import ScavioClient
client = ScavioClient(api_key="sk_live_your_key")
# 每页 10 积分,请限制循环次数。
cursor, rows = None, []
for _ in range(5):
page = client.kuaishou.search_videos(keyword="人工智能", cursor=cursor)
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 / recoPcursor
if not cursor or cursor == "no_more":
break
print(len(rows), "videos")Response
"result": 1,
"pcursor": "1",
"recoPcursor": "no_more",
"llsid": "2006155792367070114"
},
"response_time": 2560,
"credits_used": 10,
"credits_remaining": 4753
}