快手接口整理

接口地址：https://live.kuaishou.com/live_graphql

注意：
  1：下面接口调用时，请先在PC端登录快手然后复制请求头中的cookies，
     然后使用后端伪造请求头来调用快手接口，后端拿到数据后
     将数据返回给我们自己的前端。
  2：项目中只有这一个接口地址，通过调用接口中不同方法来获取不同数据
  3：后端需要使用专门的 graphql 插件去发送请求
  4：更多的接口请自行分析快手PC端的NetWork  

使用注意：
  1：PC端登录快手，然后复制请求头cookies，修改 http/index.js 中的 cookies的数值为刚刚复制的即可！

1：用户主页喜欢视频列表接口
请求：POST
调用方法：likedFeedsQuery()
方法参数：
  1：principalId 用户快手id（用户自定义的用户名）
  2：pcursor     当前的页码（类似分页的page参数），如果留空，默认第一页
  3：count       一页展示多少条数据（类似分页的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()
方法参数：
  1：count 评论数
  2：page  无用参数，但是必填默认1即可
  3：pcursor 分页的页面，每次请求都会返回下次页码
  4：photoId 要获取视频评论的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()
方法参数：
  1：count   展示多少条
  2：photoId 视频的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()
方法参数：
  1：principalId 主播的快手id，从 likedFeeds 方法 list.user.id 获得
  2：photoId     视频的id参数，从 likedFeeds 方法 list.id 中获得

调用实例：
query {
  feedById(principalId: "xxx", photoId: "xxxx") {
          currentWork {
              playUrl,poster
          }
      }
}

5：获取主播首页的视频
请求：POST
调用方法：publicFeeds()
方法参数：

  1：principalId 主播的快手id
  2：pcursor     分页页码
  3：count       一页展示多少数据

调用实例：
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()
方法参数：

  1：photoId       视频id
  2：rootCommentId 回复的顶级评论
  3：pcursor       下标
  4：count         数量

调用实例：
 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()
方法参数：

  1：photoId       视频id
  2：principalId   快手用户id
  3：cancel        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   
    } 
  }"
}



