修改repoLinkUpdateTimestamp

This commit is contained in:
develop202
2026-01-16 09:07:46 +08:00
parent 7f9e3692c1
commit 02900f38e3
6 changed files with 6526 additions and 4878 deletions

View File

@@ -1,5 +1,5 @@
// 更新时间
const repoLinkUpdateTimestamp = 1768517735218
const repoLinkUpdateTimestamp = 0
// 回放
const cntvNames = {
"CCTV1综合": "cctv1",

View File

@@ -42,6 +42,7 @@ async function getAllURL() {
const channelsURLTXT = []
const domains = {}
let sumChannel = 0
let status = 0
const headers = { Referer: "http://pro.fengcaizb.com" }
await fetch("http://pro.fengcaizb.com/channels/pro.gz", {
headers: headers
@@ -49,7 +50,8 @@ async function getAllURL() {
// await fetch("http://ds.fengcaizb.com/channels/dszb3.gz").then(async pro_gz => {
if (!pro_gz?.ok) {
printRed("请求失败")
return ""
status = 2
return 2
}
const bufferArray = await pro_gz.arrayBuffer()
const buffer = Buffer.from(bufferArray)
@@ -61,9 +63,9 @@ async function getAllURL() {
// console.log(result)
// console.log(pro_gz)
const result = JSON.parse(resultJSON)
if (result.timestamp == repoLinkUpdateTimestamp) {
printGreen(`数据已是最新,无需更新`)
return "1"
if (result.timestamp == String(repoLinkUpdateTimestamp)) {
status = 1
return 1
}
const data_jsPath = `${process.cwd()}/utils/datas.js`
@@ -142,6 +144,9 @@ async function getAllURL() {
}
}
})
if (status != 0) {
return status
}
const m3u = channelsURLM3U.join("\n")
const txt = channelsURLTXT.join("\n")
printGreen(`本次共更新${sumChannel}`)
@@ -162,11 +167,12 @@ async function updateChannels() {
const m3uFilePath = `${process.cwd()}/interface.txt`
const txtFilePath = `${process.cwd()}/interfaceTXT.txt`
const allURL = await getAllURL()
if (allURL == "1") {
return
if (allURL > 0) {
return allURL
}
writeFileSync(m3uFilePath, allURL.m3u)
writeFileSync(txtFilePath, allURL.txt)
return 0
}
export default updateChannels