mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 08:14:38 -05:00
fix shitcode :3
This commit is contained in:
parent
51a2f042c1
commit
40a8e92e80
1 changed files with 5 additions and 14 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue