233
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,6 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
downKsVideo/dist/*
|
||||
|
||||
|
||||
# local env files
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"dev": "node --max-old-space-size=20240 src/index.js",
|
||||
"http": "node-dev app.js",
|
||||
"tj": "node-dev src/tuijian.js"
|
||||
"zb": "node-dev src/visionProfileLikePhotoList.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
@@ -5,7 +5,7 @@ class GraphqlRequest {
|
||||
constructor() {
|
||||
this.client = new GraphQLClient(config.url, {
|
||||
headers: {
|
||||
Cookie: 'did=web_8e01e1d7a6199e8ad21de2e5f486f2db; clientid=3; kpf=PC_WEB; kpn=KUAISHOU_VISION'
|
||||
Cookie: 'kpf=PC_WEB; clientid=3; did=web_1debac63b767ac564381b3e54dc1de14; userId=58344290; kuaishou.server.webday7_st=ChprdWFpc2hvdS5zZXJ2ZXIud2ViZGF5Ny5zdBKwAS28zA7-aNXM3dej-9d2bBkejAcmqj3N81VfEi6InoR5aOqvxTncN3v-Uqk9AgKLWgWB1DU13-erJnrkhVdBtvxZGa-jyk983XBft3x5Gs6W7Gbmgvbnd-_7g3kz3WR7EYksKtPMKVXn3_pHLNu91hTPpT9Ifz5kAuhdeej3BJxZi3V1O5XQ1jFdk4BfthT_y33jZvfUI1qlRHfR8K2C969mhMQmisDy2WjqhUZkLA_UGhJ9HT6MbGrfdP_lNnYr-H8iHsEiIEvZa908l7ohZ_Y3lA8JBQMyEsG5ETx9F7bbEPudwvWkKAUwAQ; kuaishou.server.webday7_ph=fa6c85794f6091f1c8261e28a15425b66a23; kpn=KUAISHOU_VISION'
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ pr.on('uncaughtException', err => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 自动下载快手主播主页所有视频和图片
|
||||
* 自动下载快手喜欢的所有视频
|
||||
*/
|
||||
const main = async () => {
|
||||
console.log("开始 ==============================================================");
|
||||
|
||||
@@ -23,9 +23,10 @@ class Utils {
|
||||
init(type = "visionProfileLikePhotoList", userId) {
|
||||
this.type = type
|
||||
this.userId = userId
|
||||
this.mkDir(this.userId)
|
||||
}
|
||||
|
||||
async start(params) {
|
||||
async start() {
|
||||
let params = { page: "profile", pcursor: this.principalId }
|
||||
|
||||
this.userId ? params.userId = this.userId : null
|
||||
@@ -63,10 +64,8 @@ class Utils {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
async savefileToPath(fileData, fileName) {
|
||||
let fileFullName = path.join(__dirname, `../../dist/${fileName}.mp4`)
|
||||
let fileFullName = path.join(__dirname, `../../dist/${this.userId}/${fileName}.mp4`)
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.writeFile(fileFullName, fileData, 'binary', err => {
|
||||
if (err) {
|
||||
@@ -78,11 +77,11 @@ class Utils {
|
||||
if (this.TotalCount >= this.TotalFeeds.length) {
|
||||
console.log("-----------视频下载进度-------------");
|
||||
console.log("");
|
||||
console.log(`3:已下载:${this.TotalFeeds.length} 条视频,5秒 后将开始下载 下一页..`);
|
||||
console.log(`3:已下载:${this.TotalFeeds.length} 条视频,3秒 后将开始下载 下一页..`);
|
||||
console.log("")
|
||||
console.log("")
|
||||
|
||||
setTimeout(() => this.start(), 5000)
|
||||
setTimeout(() => this.start(), 3000)
|
||||
}
|
||||
resolve('已下载')
|
||||
}
|
||||
@@ -90,6 +89,15 @@ class Utils {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建文件夹
|
||||
* @param {*} page
|
||||
*/
|
||||
mkDir(page) {
|
||||
fs.mkdir(`dist/${page}`, err => err ? console.log(err) : console.log('文件夹创建成功'))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Utils
|
||||
@@ -1,6 +1,8 @@
|
||||
const utils = require("./utils/utils");
|
||||
|
||||
|
||||
// 下载主播主页的视频
|
||||
let u = new utils()
|
||||
// u.init("visionProfileLikePhotoList")
|
||||
u.init("visionProfilePhotoList", "3xiem77vya42p4y")
|
||||
u.start({ page: "profile", pcursor: this.principalId })
|
||||
u.init("visionProfilePhotoList", "3x8549i7ha829sg")
|
||||
u.start()
|
||||
Reference in New Issue
Block a user