1
Fork 0

fix shitcode :3

This commit is contained in:
ashley 2024-07-15 20:54:14 +00:00
parent 51a2f042c1
commit 40a8e92e80

View file

@ -316,21 +316,12 @@ module.exports = function (app, config, renderTemplate) {
let ChannelFirstVideoObject;
if (tj && tj.videos && tj.videos.length > 0) {
const source = [tj, shorts, stream].find(
(i) => i && i.videos && i.videos.length > 0
);
if (source) {
ChannelFirstVideoObject = await fetch(
`${config.invapi}/videos/${tj.videos[0].videoId}`
)
.then((res) => res.text())
.then((txt) => JSON.parse(txt));
} else if (shorts && shorts.videos && shorts.videos.length > 0) {
ChannelFirstVideoObject = await fetch(
`${config.invapi}/videos/${shorts.videos[0].videoId}`
)
.then((res) => res.text())
.then((txt) => JSON.parse(txt));
} else if (stream && stream.videos && stream.videos.length > 0) {
ChannelFirstVideoObject = await fetch(
`${config.invapi}/videos/${stream.videos[0].videoId}`
`${config.invapi}/videos/${source.videos[0].videoId}`
)
.then((res) => res.text())
.then((txt) => JSON.parse(txt));