I've made the code worse since map is an antipattern if you discard the resulting array but YOLO
This commit is contained in:
parent
51650c3f1c
commit
3bfb3212b8
1 changed files with 6 additions and 3 deletions
|
@ -234,11 +234,14 @@ async function getVideoInfo(videoID: string, session: any) {
|
||||||
}
|
}
|
||||||
let playbackUrl = null;
|
let playbackUrl = null;
|
||||||
try {
|
try {
|
||||||
playbackUrl = data["playbackUrls"].filter(
|
playbackUrl = data["playbackUrls"]
|
||||||
(item: { [x: string]: string; }) => item["mimeType"] == "application/vnd.apple.mpegurl")[0]["playbackUrl"];
|
.filter((item: { [x: string]: string; }) =>
|
||||||
|
item["mimeType"] == "application/vnd.apple.mpegurl")
|
||||||
|
.map((item: { [x: string]: string }) =>
|
||||||
|
{ return item["playbackUrl"] })[0];
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error(`Error fetching hlsUrl: ${e}`);
|
console.error(`Error fetching HLS URL: ${e}.\n playbackUrl is ${playbackUrl}`);
|
||||||
process.exit(27);
|
process.exit(27);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue