缩短更新间隔
This commit is contained in:
2
.github/workflows/updateBydszb.yml
vendored
2
.github/workflows/updateBydszb.yml
vendored
@@ -3,7 +3,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
# push:
|
# push:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: 0 */4 * * *
|
- cron: 0 */1 * * *
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ import updateChannels from "./utils/zbpro.js"
|
|||||||
const start = new Date()
|
const start = new Date()
|
||||||
printMagenta("开始更新...")
|
printMagenta("开始更新...")
|
||||||
|
|
||||||
|
|
||||||
|
printMagenta("开始更新接口文件...")
|
||||||
|
await updateChannels()
|
||||||
|
printGreen("接口文件更新完成!")
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const datas = await dataList()
|
const datas = await dataList()
|
||||||
printGreen("数据获取成功!")
|
printGreen("数据获取成功!")
|
||||||
@@ -32,8 +37,5 @@ try {
|
|||||||
printRed("回放文件更新失败!")
|
printRed("回放文件更新失败!")
|
||||||
}
|
}
|
||||||
|
|
||||||
printMagenta("开始更新接口文件...")
|
|
||||||
await updateChannels()
|
|
||||||
printGreen("接口文件更新完成!")
|
|
||||||
printGreen(`用时 ${(Date.now() - start.getTime()) / 1000}秒`)
|
printGreen(`用时 ${(Date.now() - start.getTime()) / 1000}秒`)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// 更新时间
|
||||||
|
const repoLinkUpdateTimestamp = 1768517735218
|
||||||
// 回放
|
// 回放
|
||||||
const cntvNames = {
|
const cntvNames = {
|
||||||
"CCTV1综合": "cctv1",
|
"CCTV1综合": "cctv1",
|
||||||
@@ -46,4 +48,4 @@ const domainWhiteList = [
|
|||||||
"play-qukan.cztv.com",
|
"play-qukan.cztv.com",
|
||||||
]
|
]
|
||||||
|
|
||||||
export { cntvNames, domainWhiteList }
|
export { cntvNames, domainWhiteList, repoLinkUpdateTimestamp }
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import crypto from "node:crypto"
|
|||||||
import { writeFileSync } from "node:fs"
|
import { writeFileSync } from "node:fs"
|
||||||
import { gunzipSync } from "node:zlib"
|
import { gunzipSync } from "node:zlib"
|
||||||
import { debug } from "../config.js"
|
import { debug } from "../config.js"
|
||||||
import { domainWhiteList } from "./datas.js"
|
import { domainWhiteList, repoLinkUpdateTimestamp } from "./datas.js"
|
||||||
|
import { readFileSync } from "./fileUtil.js"
|
||||||
|
|
||||||
const KEY_ARRAY = [121, 111, 117, 33, 106, 101, 64, 49, 57, 114, 114, 36, 50, 48, 121, 35]
|
const KEY_ARRAY = [121, 111, 117, 33, 106, 101, 64, 49, 57, 114, 114, 36, 50, 48, 121, 35]
|
||||||
const IV_ARRAY = [65, 114, 101, 121, 111, 117, 124, 62, 127, 110, 54, 38, 13, 97, 110, 63]
|
const IV_ARRAY = [65, 114, 101, 121, 111, 117, 124, 62, 127, 110, 54, 38, 13, 97, 110, 63]
|
||||||
@@ -60,6 +61,16 @@ async function getAllURL() {
|
|||||||
// console.log(result)
|
// console.log(result)
|
||||||
// console.log(pro_gz)
|
// console.log(pro_gz)
|
||||||
const result = JSON.parse(resultJSON)
|
const result = JSON.parse(resultJSON)
|
||||||
|
if (result.timestamp == repoLinkUpdateTimestamp) {
|
||||||
|
printGreen(`数据已是最新,无需更新`)
|
||||||
|
return "1"
|
||||||
|
}
|
||||||
|
|
||||||
|
const data_jsPath = `${process.cwd()}/utils/datas.js`
|
||||||
|
const datas_js = readFileSync(data_jsPath)
|
||||||
|
// console.log(datas_js.toString())
|
||||||
|
writeFileSync(data_jsPath, datas_js.toString().replace(repoLinkUpdateTimestamp, result.timestamp))
|
||||||
|
|
||||||
channelsURLM3U.push(`#EXTM3U x-tvg-url="https://gh-proxy.com/https://raw.githubusercontent.com/develop202/migu_video/refs/heads/main/playback.xml,https://hk.gh-proxy.org/raw.githubusercontent.com/develop202/migu_video/refs/heads/main/playback.xml,https://develop202.github.io/migu_video/playback.xml,https://raw.githubusercontents.com/develop202/migu_video/refs/heads/main/playback.xml" catchup="append" catchup-source="&playbackbegin=\${(b)yyyyMMddHHmmss}&playbackend=\${(e)yyyyMMddHHmmss}"`)
|
channelsURLM3U.push(`#EXTM3U x-tvg-url="https://gh-proxy.com/https://raw.githubusercontent.com/develop202/migu_video/refs/heads/main/playback.xml,https://hk.gh-proxy.org/raw.githubusercontent.com/develop202/migu_video/refs/heads/main/playback.xml,https://develop202.github.io/migu_video/playback.xml,https://raw.githubusercontents.com/develop202/migu_video/refs/heads/main/playback.xml" catchup="append" catchup-source="&playbackbegin=\${(b)yyyyMMddHHmmss}&playbackend=\${(e)yyyyMMddHHmmss}"`)
|
||||||
let i = 0
|
let i = 0
|
||||||
let lastChannelCate = ""
|
let lastChannelCate = ""
|
||||||
@@ -151,6 +162,9 @@ async function updateChannels() {
|
|||||||
const m3uFilePath = `${process.cwd()}/interface.txt`
|
const m3uFilePath = `${process.cwd()}/interface.txt`
|
||||||
const txtFilePath = `${process.cwd()}/interfaceTXT.txt`
|
const txtFilePath = `${process.cwd()}/interfaceTXT.txt`
|
||||||
const allURL = await getAllURL()
|
const allURL = await getAllURL()
|
||||||
|
if (allURL == "1") {
|
||||||
|
return
|
||||||
|
}
|
||||||
writeFileSync(m3uFilePath, allURL.m3u)
|
writeFileSync(m3uFilePath, allURL.m3u)
|
||||||
writeFileSync(txtFilePath, allURL.txt)
|
writeFileSync(txtFilePath, allURL.txt)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user