快手(中国)
快手用户帖子 API
分页获取快手(中国)创作者的热门帖子(作品):文案、播放 / 点赞 / 评论 / 分享 / 收藏数、时长、发布时间、封面图和视频地址,以 JSON 返回。每页消耗 1 积分,是拉取创作者作品列表的低成本方式(用户主页接口要 10 积分)。采用游标分页:把响应中的 pcursor 作为 cursor 传回即可。
POST/api/v1/kuaishou/user/posts
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/jsonuser_idstringrequired快手用户 id,不能为空。可通过分享链接解析或用户搜索接口获取。
Example: 228905802
cursorstring不透明的分页游标(cursor)。第一页不传,之后传入上一次响应中的 pcursor 值。响应字段名是 pcursor,不是 next_cursor。pcursor 为 "no_more" 表示没有更多页。
Example: 31
Request
from scavio import ScavioClient
client = ScavioClient(api_key="sk_live_your_key")
cursor = None
while True:
page = client.kuaishou.user_posts(user_id="228905802", cursor=cursor)
for feed in page["data"].get("feeds", []):
print(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": "31",
"llsid": "2009910158783876017"
},
"response_time": 2944,
"credits_used": 1,
"credits_remaining": 4819
}