add 优化代码,新增获取腾讯视频播放列表
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const {spawn} = require('child_process');
|
||||
const path = require('path');
|
||||
const { cwd } = require('process');
|
||||
const {cwd} = require('process');
|
||||
|
||||
|
||||
function seep(time) {
|
||||
@@ -11,19 +11,33 @@ function seep(time) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取腾讯视频播放列表
|
||||
* @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 +48,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 +82,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 +90,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 +147,6 @@ module.exports = {
|
||||
dow,
|
||||
getVideoSpecifyTimeImage,
|
||||
getMediaInfo,
|
||||
createTorrent
|
||||
createTorrent,
|
||||
getTencentVideoPlayList
|
||||
}
|
||||
Reference in New Issue
Block a user