快手(中国)
快手热榜 API
读取快手(中国)的实时榜单:热搜榜以及直播、购物、品牌和音乐榜,每次调用一个榜单,以 JSON 返回。热搜榜返回 50 个排好序的关键词,附带快手自己的热度值,每次 1 积分,是该平台最便宜的趋势信号,也很适合作为话题信息流或视频搜索的输入。快手按接口计费(1、2、10 或 40 积分),本接口属于 1 积分一档。不分页:一个榜单,一个快照。
POST/api/v1/kuaishou/trending
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/jsonboardenum<string>default:hot要读取的榜单。每次调用一个榜单,无法一次获取多个,每次调用消耗 1 积分。每个榜单都是一份独立的排行,响应结构各不相同,所以在映射字段之前,先把需要的那个榜单调用一次看看。
hot— 默认值。热搜关键词榜:data.hots 下 50 个排序条目,另有置顶的 data.topHots。live— 直播榜。shopping— 购物 / 电商榜。brand— 品牌榜。music— 音乐榜。
Request
from scavio import ScavioClient
client = ScavioClient(api_key="sk_live_your_key")
# 1 积分。不传 board 等同于 board="hot"。
board = client.kuaishou.trending(board="hot")
for row in board["data"]["hots"][:10]:
print(row["hotValue"], row["keyword"])
# 把热搜关键词直接传给低成本的发现类接口
top = board["data"]["hots"][0]["keyword"]
feed = client.kuaishou.tag_feed(tag=top) # 1 积分
print(len(feed["data"].get("mixFeeds", [])), "posts for", top)Response
"result": 1,
"llsid": "2009970839368476817"
},
"response_time": 1612,
"credits_used": 1,
"credits_remaining": 4731
}