mirror of
https://github.com/develop202/migu_video.git
synced 2025-12-18 15:55:10 +08:00
添加蓝光、高清、标清
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
import fs from "fs"
|
||||
import { data_list, getUrlInfo } from "./utils/fetchList.js"
|
||||
import { data_list, delay, getUrlInfo } from "./utils/fetchList.js"
|
||||
import { getEncryptURL, init_wasm } from "./utils/getddCalcuURL.js"
|
||||
import { channelName } from "./utils/datas.js"
|
||||
|
||||
function delay(ms) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms)
|
||||
})
|
||||
}
|
||||
|
||||
async function fetch_url() {
|
||||
async function fetchURLByWasm() {
|
||||
|
||||
// 必须绝对路径
|
||||
let path = process.cwd() + '/interface.txt'
|
||||
@@ -21,7 +16,8 @@ async function fetch_url() {
|
||||
console.log("文件创建成功")
|
||||
})
|
||||
}
|
||||
await delay(1000)
|
||||
// 等待文件创建
|
||||
await delay(500)
|
||||
|
||||
// 备份文件
|
||||
fs.copyFile(path, path + ".bak", error => {
|
||||
@@ -31,17 +27,21 @@ async function fetch_url() {
|
||||
console.log("文件备份成功")
|
||||
})
|
||||
|
||||
await delay(1000)
|
||||
// 等待文件备份
|
||||
await delay(500)
|
||||
fs.writeFile(path, "", error => {
|
||||
if (error) {
|
||||
throw new Error("文件清除失败")
|
||||
}
|
||||
console.log("文件清除成功")
|
||||
})
|
||||
let datas = await data_list()
|
||||
// 所有数据
|
||||
// let datas = await data_list()
|
||||
const datas = channelName
|
||||
// 获取加密方法
|
||||
const exports = await init_wasm("https://m.miguvideo.com/mgs/player/prd/v_20250506111629_ddc2c612/dist/pickproof1000.wasm")
|
||||
// 写入分类
|
||||
for (let i = 0; i < datas.length; i++) {
|
||||
|
||||
console.log("正在写入分类###:" + datas[i].name)
|
||||
// 写入分类数据
|
||||
fs.appendFile(path, datas[i].name + ",#genre#\n", error => {
|
||||
@@ -51,27 +51,23 @@ async function fetch_url() {
|
||||
})
|
||||
|
||||
let data = datas[i].dataList
|
||||
// 写入分类中的节目
|
||||
for (let j = 0; j < data.length; j++) {
|
||||
console.log("正在准备节目")
|
||||
let link
|
||||
// console.log(data[j].pID)
|
||||
// try {
|
||||
// 获取播放链接
|
||||
let url = await getUrlInfo(data[j].pID)
|
||||
if (url == "") {
|
||||
console.log("节目调整")
|
||||
console.log(data[j].name + ":节目调整,暂不提供服务")
|
||||
continue
|
||||
}
|
||||
// 加密链接
|
||||
link = getEncryptURL(exports, url)
|
||||
// link = await fetch(base_link, {
|
||||
// method: "GET"
|
||||
// }).then(res => res.text())
|
||||
|
||||
if (!link) {
|
||||
continue
|
||||
}
|
||||
// } catch (error) {
|
||||
// throw new Error("链接获取失败")
|
||||
// }
|
||||
console.log("正在写入节目:" + data[j].name)
|
||||
// 写入分类数据
|
||||
fs.appendFile(path, data[j].name + "," + link + "\n", error => {
|
||||
@@ -80,8 +76,7 @@ async function fetch_url() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fetch_url()
|
||||
fetchURLByWasm()
|
||||
|
||||
Reference in New Issue
Block a user