mirror of
https://github.com/develop202/migu_video.git
synced 2025-12-17 15:25:03 +08:00
更新
This commit is contained in:
@@ -9,64 +9,41 @@ function delay(ms) {
|
||||
|
||||
// 获取分类集合
|
||||
async function cateList() {
|
||||
try {
|
||||
const resp = await axios.get("https://program-sc.miguvideo.com/live/v2/tv-data/1ff892f2b5ab4a79be6e25b69d2f5d05")
|
||||
let liveList = resp.data.body.liveList
|
||||
// 热门内容重复
|
||||
liveList = liveList.filter((item) => {
|
||||
return item.name != "热门"
|
||||
})
|
||||
const resp = await axios.get("https://program-sc.miguvideo.com/live/v2/tv-data/1ff892f2b5ab4a79be6e25b69d2f5d05")
|
||||
let liveList = resp.data.body.liveList
|
||||
// 热门内容重复
|
||||
liveList = liveList.filter((item) => {
|
||||
return item.name != "热门"
|
||||
})
|
||||
|
||||
// 央视作为首个分类
|
||||
liveList.sort((a, b) => {
|
||||
if (a.name === "央视") return -1;
|
||||
if (b.name === "央视") return 1
|
||||
return 0
|
||||
})
|
||||
// 央视作为首个分类
|
||||
liveList.sort((a, b) => {
|
||||
if (a.name === "央视") return -1;
|
||||
if (b.name === "央视") return 1
|
||||
return 0
|
||||
})
|
||||
|
||||
return liveList
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
return liveList
|
||||
}
|
||||
|
||||
// 所有数据
|
||||
async function dataList() {
|
||||
try {
|
||||
let cates = await cateList()
|
||||
let cates = await cateList()
|
||||
|
||||
for (let cate in cates) {
|
||||
try {
|
||||
const resp = await axios.get("https://program-sc.miguvideo.com/live/v2/tv-data/" + cates[cate].vomsID)
|
||||
cates[cate].dataList = resp.data.body.dataList
|
||||
} catch (error) {
|
||||
cates[cate].dataList = [];
|
||||
}
|
||||
for (let cate in cates) {
|
||||
try {
|
||||
const resp = await axios.get("https://program-sc.miguvideo.com/live/v2/tv-data/" + cates[cate].vomsID)
|
||||
cates[cate].dataList = resp.data.body.dataList
|
||||
} catch (error) {
|
||||
cates[cate].dataList = [];
|
||||
}
|
||||
|
||||
// 去除重复节目
|
||||
cates = uniqueData(cates)
|
||||
// console.dir(cates, { depth: null })
|
||||
// console.log(cates)
|
||||
return cates
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
// 获取电视链接
|
||||
async function getUrlInfo(contId) {
|
||||
try {
|
||||
const resp = await axios.get(`https://webapi.miguvideo.com/gateway/playurl/v2/play/playurlh5?contId=${contId}&rateType=999&clientId=-&startPlay=true&xh265=false&channelId=0131_200300220100002`)
|
||||
// console.log(resp.data.body.urlInfo.url)
|
||||
// console.log(resp.data)
|
||||
if (resp.data?.body?.urlInfo?.url) {
|
||||
return resp.data.body.urlInfo.url
|
||||
}
|
||||
return ""
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
// 去除重复节目
|
||||
cates = uniqueData(cates)
|
||||
// console.dir(cates, { depth: null })
|
||||
// console.log(cates)
|
||||
return cates
|
||||
}
|
||||
|
||||
// 对data的dataList去重
|
||||
@@ -120,4 +97,4 @@ function uniqueData(liveList) {
|
||||
return liveList
|
||||
}
|
||||
|
||||
export { cateList, dataList, getUrlInfo, delay }
|
||||
export { cateList, dataList, delay }
|
||||
|
||||
Reference in New Issue
Block a user