Files
ksapi/ksAll/config/index.js
2024-09-27 01:15:04 +08:00

235 lines
6.3 KiB
JavaScript

const { gql } = require("graphql-request");
module.exports = {
// 快手直播,视频有版权
url: 'https://live.kuaishou.com/live_graphql',
// 快手官方 视频无版权
kuaishouUrl: 'https://www.kuaishou.com/graphql',
// 没有水印的 获取主播主页的视频
visionProfilePhotoList: `https://live.kuaishou.com/live_api/profile/public`,
// 没有水印的 你点赞的视频
visionProfileLikePhotoList: gql`
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
}
}`,
// 获取展开的评论
subCommentList: (photoId, rootCommentId, pcursor = "") => {
return `
{
subCommentList(photoId: "${photoId}", rootCommentId: "${rootCommentId}", pcursor: "${pcursor}", count: 20) {
pcursor
subCommentsList {
commentId,authorId,authorName,content
headurl,timestamp,authorEid,status,replyToUserName,replyTo,
replyToEid
}
}
}`
},
// 获取视频相关的推荐
RecommendFeeds: (photoId) => {
return `
{
videoRecommendFeeds(photoId: "${photoId}", count: 40) {
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
}
}
}
`
},
// 获取默认评论
shortVideoCommentList: (photoId, pcursor = "") => {
return `{
shortVideoCommentList(photoId: "${photoId}", page: 1, pcursor: "${pcursor}", count: 100) {
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
}
}
}
}`
},
// 喜欢页面 请求参数
likedFeeds: (pcursor = "") => {
return `{
likedFeeds(principalId: "geekhelp", pcursor: "${pcursor}", count: 42) {
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
}
}
}`;
},
// 视频真实播放地址 请求参数
feedById: (principalId, photoId) => {
return `{
feedById(principalId: "${principalId}", photoId: "${photoId}") {
currentWork {
playUrl,poster,caption
}
}
}`;
},
publicFeeds: (principalId, pcursor = "", count = 24) => {
return `{
publicFeeds(principalId: "${principalId}", pcursor: "${pcursor}", count: ${count}) {
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
}
}
}`
},
likeVideo: (principalId, photoId, cancel) => {
return `
{
visionVideoLike(photoId: "${photoId}", photoAuthorId: "${principalId}", cancel: ${cancel}, expTag: "1_i/2001342433838605970_xpcwebprofilexxnull0") {
result
}
}
`
}
};