first commit

This commit is contained in:
编码猿
2024-09-27 01:15:04 +08:00
commit 89004b22d2
47 changed files with 4871 additions and 0 deletions

View File

@@ -0,0 +1,201 @@
快手接口整理
接口地址https://live.kuaishou.com/live_graphql
注意:
1下面接口调用时请先在PC端登录快手然后复制请求头中的cookies
然后使用后端伪造请求头来调用快手接口,后端拿到数据后
将数据返回给我们自己的前端。
2项目中只有这一个接口地址通过调用接口中不同方法来获取不同数据
3后端需要使用专门的 graphql 插件去发送请求
4更多的接口请自行分析快手PC端的NetWork
使用注意:
1PC端登录快手然后复制请求头cookies修改 http/index.js 中的 cookies的数值为刚刚复制的即可
1用户主页喜欢视频列表接口
请求POST
调用方法likedFeedsQuery()
方法参数:
1principalId 用户快手id用户自定义的用户名
2pcursor 当前的页码类似分页的page参数如果留空默认第一页
3count 一页展示多少条数据类似分页的limit参数默认24
调用实例:
query {
likedFeeds(principalId: "geekhelp", pcursor: "1.582321864999E12", count: 24) {
pcursor
list {
id,thumbnailUrl,poster,workType,type,useVideoPlayer,imgUrls,imgSizes,magicFace,
musicName,caption,location,liked,onlyFollowerCanComment,relativeHeight,timestamp,width,height,
counts {
displayView,displayLike,displayComment
},
user {
id,eid,name,avatar,
},
expTag
}
}
}
2获取视频的评论
请求POST
调用方法commentListQuery()
方法参数:
1count 评论数
2page 无用参数但是必填默认1即可
3pcursor 分页的页面,每次请求都会返回下次页码
4photoId 要获取视频评论的id
query {
shortVideoCommentList(photoId: '', page: 1, pcursor: '', count: 20t) {
commentCount,realCommentCount,pcursor,
commentList {
commentId,authorId,authorName,content,headurl,timestamp,authorEid,status,
subCommentCount,subCommentsPcursor,likedCount,liked,
subComments {
commentId,authorId,authorName,content,headurl,timestamp,authorEid
status,replyToUserName,replyTo,replyToEid
}
}
}
}
3获取热门推荐视频
请求POST
调用方法videoRecommendFeeds()
方法参数:
1count 展示多少条
2photoId 视频的id参数
调用实例:
query {
videoRecommendFeeds(photoId: $photoId, count: $count) {
list {
user {
id,avatar,name
},
id,thumbnailUrl,poster,workType,type,useVideoPlayer,imgUrls,
imgSizes,magicFace,musicName,caption,location,liked,onlyFollowerCanComment,
relativeHeight,timestamp,width,height,
counts {
displayView,displayLike,displayComment
},
expTag
}
}
}
4获取视频的真实MP4播放地址
请求POST
调用方法feedById()
方法参数:
1principalId 主播的快手id从 likedFeeds 方法 list.user.id 获得
2photoId 视频的id参数从 likedFeeds 方法 list.id 中获得
调用实例:
query {
feedById(principalId: "xxx", photoId: "xxxx") {
currentWork {
playUrl,poster
}
}
}
5获取主播首页的视频
请求POST
调用方法publicFeeds()
方法参数:
1principalId 主播的快手id
2pcursor 分页页码
3count 一页展示多少数据
调用实例:
query {
publicFeeds(principalId: "xxxx", pcursor: "xxxx", count: 24) {
pcursor,
list {
id,thumbnailUrl,poster,workType,type,useVideoPlayer,imgUrls,imgSizes,magicFace,musicName,
caption,location,liked,onlyFollowerCanComment,relativeHeight,timestamp,width,height,
counts {
displayView,displayLike,displayComment
},
user {
id,eid,name,avatar,cityName
},
expTag
}
}
}
6获取视频回复的展开更多
请求POST
调用方法subCommentList()
方法参数:
1photoId 视频id
2rootCommentId 回复的顶级评论
3pcursor 下标
4count 数量
调用实例:
query {
subCommentList(photoId: $photoId, rootCommentId: $rootCommentId, pcursor: $pcursor, count: $count) {
pcursor
subCommentsList {
commentId,authorId,authorName,content
headurl,timestamp,authorEid,status,replyToUserName,replyTo,
replyToEid
}
}
}
7对视频进行 喜欢收藏
请求POST
调用方法likeVideo()
方法参数:
1photoId 视频id
2principalId 快手用户id
3cancel 0 喜欢1 取消喜欢
query {
likeVideo(photoId: $photoId, principalId: $principalId, cancel: $cancel) {
result
}
}
7获取自己关注的主播有哪些正在进行直播
请求GET
https://live.kuaishou.com/rest/wd/live/liveStream/myfollow
{
"operationName":"visionProfileLikePhotoList",
"variables": {
"pcursor":"${pcursor}","page":"${page}"
},
"query": "
fragment photoContent on PhotoEntity
{ __typename id duration caption originCaption likeCount viewCount commentCount realLikeCount coverUrl photoUrl photoH265Url manifest manifestH265 videoResource coverUrls { url __typename } timestamp expTag animatedCoverUrl distance videoRatio liked stereoType profileUserTopPhoto musicBlocked }
fragment recoPhotoFragment on recoPhotoEntity { __typename id duration caption originCaption likeCount viewCount commentCount realLikeCount coverUrl photoUrl photoH265Url manifest manifestH265 videoResource coverUrls { url __typename } timestamp expTag animatedCoverUrl distance videoRatio liked stereoType profileUserTopPhoto musicBlocked }
fragment feedContent on Feed { type author { id name headerUrl following headerUrls { url __typename } __typename } photo { ...photoContent ...recoPhotoFragment __typename } canAddComment llsid status currentPcursor tags { type name __typename } __typename }
query visionProfileLikePhotoList($pcursor: String, $page: String, $webPageArea: String) {
visionProfileLikePhotoList(pcursor: $pcursor, page: $page, webPageArea: $webPageArea) {
result,llsid,webPageArea,
feeds {
...feedContent,__typename
},
hostName,pcursor,__typename
}
}"
}