This commit is contained in:
2023-07-04 21:43:52 +08:00
23 changed files with 299 additions and 74 deletions

View File

@@ -22,7 +22,7 @@ async function getQqListData(url) {
console.log(list)
for (let i of list) {
if (i && i.innerText) {
if ("全部" == i.innerText.trim()) {
if ("全部" === i.innerText.trim()) {
i.click()
}
}

View File

@@ -1,7 +1,8 @@
const {spawn} = require('child_process');
const path = require('path');
const { cwd } = require('process');
const {cwd} = require('process');
const {readFile} = require("fs");
const {post} = require("axios");
function seep(time) {
return new Promise((res) => {
@@ -11,19 +12,50 @@ function seep(time) {
})
}
/**
* 上传图片至图床 (暂不可用)
* @param filePath 图片路径
*/
function uploadImg(filePath) {
readFile(filePath, function (err, data) {
let formData = new FormData()
formData.append('file', data)
post('https://image.zmpt.cc/upload/localhost', formData).then((response, headers) => {
console.info(response)
})
})
}
/**
* 获取视频截图 (目前不可用,不好使)
* 获取腾讯视频播放列表
* @param {String}cid 视频id
* @returns {JSON} 播放列表等参数
*/
function getTencentVideoPlayList(cid) {
return new Promise((resolve) => {
const lux = spawn("./bin/getTencentVideoPlayList.exe", [cid, 'vversion_name=8.2.95;', 1])
lux.stdout.on('data', (data) => {
resolve(JSON.parse(String(data)))
});
})
}
/**
* 获取视频截图
* @param {String} filePath 文件绝对路径
* @param {number} seconds 时间
* @param {Promise<String>} save 保存绝对路径(含文件名)
* @param {string} save 保存绝对路径(含文件名)
* @returns {Promise<String>} 文件位置(待定)
*/
function getVideoSpecifyTimeImage(filePath, seconds, save) {
return new Promise((resolve) => {
const lux = spawn("ffmpeg", ['-ss',`${formatSeconds(seconds)}`,'-i',filePath,'-vframes','1',save],{
env:{
path:path.join(cwd(),'./bin/')
const lux = spawn("ffmpeg", ['-ss', `${formatSeconds(seconds)}`, '-i', filePath, '-vframes', '1', save], {
env: {
path: path.join(cwd(), './bin/')
}
})
lux.stdout.on('data', (data) => {
@@ -34,7 +66,7 @@ function getVideoSpecifyTimeImage(filePath, seconds, save) {
console.log(code.toString())
resolve(save)
});
lux.stderr.on("data",(err)=>{
lux.stderr.on("data", (err) => {
console.log(String(err))
})
console.log(lux)
@@ -68,7 +100,7 @@ function createTorrent(filePath, save) {
lux.stdout.on('data', (data) => {
response += data
});
lux.stdout.on('close', (code) => {
lux.stdout.on('close', () => {
resolve(response)
})
})
@@ -76,9 +108,9 @@ function createTorrent(filePath, save) {
function dow(info, callback) {
const lux = spawn("yt-dlp", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url],{
env:{
path:path.join(cwd(),'./bin/')
const lux = spawn("yt-dlp", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url], {
env: {
path: path.join(cwd(), './bin/')
}
})
lux.stdout.on('data', (data) => {
@@ -133,5 +165,7 @@ module.exports = {
dow,
getVideoSpecifyTimeImage,
getMediaInfo,
createTorrent
createTorrent,
getTencentVideoPlayList,
uploadImg
}