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

138 lines
2.4 KiB
JavaScript

const { GraphQLClient, gql } = require("graphql-request");
let endpoint = "https://www.kuaishou.com/graphql"
const client = new GraphQLClient(endpoint,{
headers: {
Cookie: `kpf=PC_WEB; clientid=3; did=web_fca770657d0a24abb53ddc92bb42e612; userId=58344290; kuaishou.server.web_st=ChZrdWFpc2hvdS5zZXJ2ZXIud2ViLnN0EqAB1fPdEwVz-66onvsCh3_P63LjDKblDxAADr2K_kXSZrxEVrX_oU2KKUvZl5YqwPjiOUq-a9m0TlOEs10dBkNF5QpOYQ_s3fbtjyCLi1qrDML64T3Nv3pFwAl1GFULe4arg_hUh6AATsNaXUVr_BteoLpk1WW804aC1U_F1oUPwxulQzqXvUIXngHXO6YPd1dAHtgR77dRIXaK9UswU846xhoS7YoRGiN2PM_7zCD1Dj9m5oYoIiAxx8D3DhwHW8EIVCxWj6oplmurEtbP8DIF7aORbq6y1igFMAE; kuaishou.server.web_ph=bd89383a1964446aa9fb3a806f64776467fc; kpn=KUAISHOU_VISION`,
}
})
const document = 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
}
}`
const variables = {
page: "profile",
pcursor: ""
}
client.request(document,variables)
.then(res => {
console.log("请求的数据为:");
console.log(res);
})
.catch(error => {
console.log("请求的错误为:");
console.log(error);
})