{"id":28426919,"url":"https://github.com/helpcode/kuaishou","last_synced_at":"2025-06-27T07:32:01.878Z","repository":{"id":45560445,"uuid":"138839809","full_name":"helpcode/KuaiShou","owner":"helpcode","description":"解析快手视频，一键下载主播主页视频列表。","archived":false,"fork":false,"pushed_at":"2023-03-02T01:28:09.000Z","size":72,"stargazers_count":86,"open_issues_count":3,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-05T11:49:41.396Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helpcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-27T06:35:04.000Z","updated_at":"2025-05-04T03:15:24.000Z","dependencies_parsed_at":"2023-01-24T15:15:55.770Z","dependency_job_id":null,"html_url":"https://github.com/helpcode/KuaiShou","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/helpcode/KuaiShou","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpcode%2FKuaiShou","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpcode%2FKuaiShou/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpcode%2FKuaiShou/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpcode%2FKuaiShou/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helpcode","download_url":"https://codeload.github.com/helpcode/KuaiShou/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpcode%2FKuaiShou/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262212596,"owners_count":23275959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-05T11:37:25.042Z","updated_at":"2025-06-27T07:32:01.867Z","avatar_url":"https://github.com/helpcode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 注意！！注意！！注意！！注意！！\n\n这个项目的代码已经失效，因为快手的接口采用GraphQL重写了！！\n\n如果确实需要快手接口的数据，可以从快手pc端爬数据，本人这里已经整理出很多自己用的接口了！！\n\n**下面这些接口需要你自己实现后端去调用，然后把数据返回给自己的前端即可。如果你只想用现成的，可以使用我写好的接口**\n\n**项目目前还没部署，有需要的可以找我要！！**\n\n## 最新快手接口文档\n\n快手接口整理\n\n接口地址：https://live.kuaishou.com/m_graphql\n\n注意：\n\n  - 1：下面接口调用时，请先在PC端登录快手然后复制请求头中的cookies，然后使用后端伪造请求头来调用快手接口，后端拿到数据后\n     将数据返回给我们自己的前端。\n  - 2：项目中只有这一个接口地址，通过调用接口中不同方法来获取不同数据\n  - 3：后端需要使用专门的 graphql 插件去发送请求\n\n\n**1：用户主页喜欢视频列表接口**\n\n请求：POST\n\n调用方法：likedFeedsQuery()\n\n方法参数：\n  - 1：principalId 用户快手id（用户自定义的用户名）\n  - 2：pcursor     当前的页码（类似分页的page参数），如果留空，默认第一页\n  - 3：count       一页展示多少条数据（类似分页的limit参数），默认24\n\n调用实例：\n```js\nquery {\n    likedFeeds(principalId: \"geekhelp\", pcursor: \"1.582321864999E12\", count: 24) {\n        pcursor\n        list {\n            id,thumbnailUrl,poster,workType,type,useVideoPlayer,imgUrls,imgSizes,magicFace,\n            musicName,caption,location,liked,onlyFollowerCanComment,relativeHeight,timestamp,width,height,\n            counts {\n                displayView,displayLike,displayComment\n            },\n            user {\n                id,eid,name,avatar,\n            },\n            expTag\n        }\n    }\n}\n```\n\n**2：获取视频的评论**\n\n请求：POST\n\n调用方法：commentListQuery()\n\n方法参数：\n  - 1：count 评论数\n  - 2：page  无用参数，但是必填默认1即可\n  - 3：pcursor 分页的页面，每次请求都会返回下次页码\n  - 4：photoId 要获取视频评论的id\n  \n```js\nquery {\n   shortVideoCommentList(photoId: '', page: 1,  pcursor: '', count: 20t) {\n     commentCount,realCommentCount,pcursor,\n     commentList {\n       commentId,authorId,authorName,content,headurl,timestamp,authorEid,status,\n       subCommentCount,subCommentsPcursor,likedCount,liked,\n       subComments {\n           commentId,authorId,authorName,content,headurl,timestamp,authorEid\n           status,replyToUserName,replyTo,replyToEid\n       }\n     }\n   }\n}\n```\n\n**3：获取热门推荐视频**\n\n请求：POST\n\n调用方法：videoRecommendFeeds()\n\n方法参数：\n  - 1：count   展示多少条\n  - 2：photoId 视频的id参数\n\n调用实例：\n\n```js\nquery {\n  videoRecommendFeeds(photoId: $photoId, count: $count) {\n    list {\n      user {\n        id,avatar,name\n      },\n      id,thumbnailUrl,poster,workType,type,useVideoPlayer,imgUrls,\n      imgSizes,magicFace,musicName,caption,location,liked,onlyFollowerCanComment,\n      relativeHeight,timestamp,width,height,\n      counts {\n        displayView,displayLike,displayComment\n      },\n      expTag\n    }\n  }\n}\n```\n\n**4：获取视频的真实MP4播放地址**\n\n请求：POST\n\n调用方法：feedById()\n\n方法参数：\n  - 1：principalId 主播的快手id，从 likedFeeds 方法 list.user.id 获得\n  - 2：photoId     视频的id参数，从 likedFeeds 方法 list.id 中获得\n\n调用实例：\n```js\nquery {\n  feedById(principalId: \"xxx\", photoId: \"xxxx\") {\n          currentWork {\n              playUrl,poster\n          }\n      }\n}\n```\n\n**5：获取主播首页的视频**\n\n请求：POST\n\n调用方法：publicFeeds()\n\n方法参数：\n\n  - 1：principalId 主播的快手id\n  - 2：pcursor     分页页码\n  - 3：count       一页展示多少数据\n\n调用实例：\n\n```js\nquery {\n   publicFeeds(principalId: \"xxxx\", pcursor: \"xxxx\", count: 24) {\n       pcursor,\n        list {\n            id,thumbnailUrl,poster,workType,type,useVideoPlayer,imgUrls,imgSizes,magicFace,musicName,\n            caption,location,liked,onlyFollowerCanComment,relativeHeight,timestamp,width,height,\n            counts {\n                displayView,displayLike,displayComment\n            },\n            user {\n                id,eid,name,avatar,cityName\n            },\n            expTag\n        }\n   }\n}\n```\n\n\n**6：获取视频回复的展开更多**\n\n请求：POST\n\n调用方法：subCommentList()\n\n方法参数：\n\n  - 1：photoId       视频id\n  - 2：rootCommentId 回复的顶级评论\n  - 3：pcursor       下标\n  - 4：count         数量\n\n调用实例：\n\n```js\n query {\n  subCommentList(photoId: $photoId, rootCommentId: $rootCommentId, pcursor: $pcursor, count: $count) {\n    pcursor\n    subCommentsList {\n      commentId,authorId,authorName,content\n      headurl,timestamp,authorEid,status,replyToUserName,replyTo,\n      replyToEid\n    }\n  }\n}\n```\n\n**7：对视频进行 喜欢收藏**\n\n请求：POST\n\n调用方法：likeVideo()\n\n方法参数：\n\n  - 1：photoId       视频id\n  - 2：principalId   快手用户id\n  - 3：cancel        0 喜欢，1 取消喜欢\n  \n```js  \nquery {\n  likeVideo(photoId: $photoId, principalId: $principalId, cancel: $cancel) {\n    result\n  }\n}\n```\n\n**7：获取自己关注的主播，有哪些正在进行直播**\n\n请求：GET\n\nhttps://live.kuaishou.com/rest/wd/live/liveStream/myfollow\n\n\n\n----\n\n\n\n# 接口（已经失效了，不要使用！！！！）\n\n---\n\n!\u003e 注意：接口统一运行在 http://xxx.com:3000/api/v1.0/json\n\n## 1: 获取主播的主页数据\n\n---\n\n| 接口地址      | 请求方式 | 参数                   |\n| :------------ | :------- | ---------------------- |\n| /index/userid | GET      | userid：主播快手 id 号 |\n\n- 实例：[http://127.0.0.1:3000/api/v1.0/json/index/3xy5mxzf9wbsjsi](http://127.0.0.1:3000/api/v1.0/json/index/3xy5mxzf9wbsjsi)\n\n- 数据返回：\n\n```json\n{\n  \"list\": [\n    {\n      \"eid\": \"1XPaCXnlajP7IcljrHEWDVSg\",\n      \"photoId\": \"1XYbUaSReeL-vGnBbJPxQWvg\",\n      \"caption\": \"xxxxxx\",\n      \"thumbnailUrl\":\n        \"https://tx2.a.yximgs.com/upic/2018/05/08/16/BMjAxODA1MDgxNjIwNDdfNTgxMDQ0NzgwXzYyMDgyNjU2MTlfMV8z_Bf1c7bff50f37be6b0d906b2cc5a4e81e.jpg\",\n      \"viewCount\": \"1.2w\",\n      \"likeCount\": \"602\",\n      \"commentCount\": \"51\",\n      \"timestamp\": 1525767652400,\n      \"workType\": \"video\",\n      \"type\": \"work\",\n      \"href\":\n        \"https://www.kuaishou.com/photo/1XPaCXnlajP7IcljrHEWDVSg/1XYbUaSReeL-vGnBbJPxQWvg?f=pc_live\"\n    }\n  ],\n  \"pcursor\": \"1.525141391674E12\",\n  \"userInfo\": {\n    \"eid\": \"1XPaCXnlajP7IcljrHEWDVSg\",\n    \"kwaiId\": \"xxx\",\n    \"userId\": 581044780,\n    \"id\": \"xxx\",\n    \"profile\":\n      \"https://tx2.a.yximgs.com/uhead/AB/2018/03/28/14/BMjAxODAzMjgxNDQ1MDFfNTgxMDQ0NzgwXzJfaGQ0NzRfNzI1_s.jpg\",\n    \"name\": \"抱xxx走xxx\",\n    \"description\":\n      \"....支持快手🔥\\n......................👆  取关的，感谢你曾经的关注❤\\n\\n👗微❤\",\n    \"sex\": \"F\",\n    \"cityName\": \"\",\n    \"following\": 0,\n    \"living\": false,\n    \"isNew\": false,\n    \"countsInfo\": {\n      \"fan\": \"6.1w\",\n      \"follow\": \"178\",\n      \"photo\": \"155\"\n    }\n  },\n  \"principalId\": \"xxxxx\"\n}\n```\n\n## 2: 获取对应主播主页视频(数据分页)\n\n---\n\n| 接口地址                  | 请求方式 | 参数                                                                           |\n| :------------------------ | :------- | ------------------------------------------------------------------------------ |\n| /videolist/userid/pcursor | GET      | userid：主播快手 id 号\u003cbr\u003e pcursor: 下一页的页码，[接口 1] 的 pcursor 字段数值 |\n\n- 实例：[http://127.0.0.1:3000/api/v1.0/json/videolist/3xy5mxzf9wbsjsi/1.501168403403E12](http://127.0.0.1:3000/api/v1.0/json/videolist/3xy5mxzf9wbsjsi/1.501168403403E12)\n\n- 数据返回：\n\n```json\n{\n  \"result\": 1,\n  \"list\": [\n    {\n      \"eid\": \"1XPaCXnlajP7IcljrHEWDVSg\",\n      \"photoId\": \"1XYbUaSReeL-s38rT3SzP7Rw\",\n      \"caption\": \"蚊xsxs😭😭xxx😹😹.xsxs个xsxs😨😨\",\n      \"thumbnailUrl\":\n        \"https://tx2.a.yximgs.com/upic/2018/04/20/13/BMjAxODA0MjAxMzUxMDNfNTgxMDQ0NzgwXzU5NjAxNDUzNjNfMV8z_B38c81af3e58101bb5880197f1fe8be7f.jpg\",\n      \"viewCount\": \"1.6w\",\n      \"likeCount\": \"370\",\n      \"commentCount\": \"40\",\n      \"timestamp\": 1524203473650,\n      \"workType\": \"video\",\n      \"type\": \"work\",\n      \"href\":\n        \"https://www.kuaishou.com/photo/1XPaCXnlajP7IcljrHEWDVSg/1XYbUaSReeL-s38rT3SzP7Rw?f=pc_live\"\n    }\n  ],\n  \"pcursor\": \"1.522636912545E12\"\n}\n```\n\n## 3: 解析视频的真实 mp4 播放地址\n\n---\n\n| 接口地址            | 请求方式 | 参数                                                                                                        |\n| :------------------ | :------- | ----------------------------------------------------------------------------------------------------------- |\n| /down?href=videourl | GET      | href：[接口 1][接口2] 视频列表中字段 \"href\" \u003cbr/\u003e 为视频快手在线播放地址放入这里解析将获得视频真实 mp4 地址 |\n\n- 实例：[http://127.0.0.1:3000/api/v1.0/json/down?href=https://www.kuaishou.com/...-1rxNhtLFw?f=pc_live](http://127.0.0.1:3000/api/v1.0/json/down?href=https://www.kuaishou.com/...-1rxNhtLFw?f=pc_live)\n\n- 数据返回：\n\n```json\n{\n  \"satus\": \"Parse The Success\",\n  \"video\":\n    \"https://txmov2.a.yximgs.com/upic/2018/04/20/13/BMjAxODA0MjAxMzUxMDNfNTgxMDQ0NzgwXzU5NjAxNDUzNjNfMV8z_b_B2176b04496bb89fd4e3a091668847559.mp4\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpcode%2Fkuaishou","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpcode%2Fkuaishou","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpcode%2Fkuaishou/lists"}