1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-17 05:22:18 +00:00

Let's use an ES6 array filter cause we influencers boy

This commit is contained in:
snobu
2020-03-30 11:05:42 +03:00
parent 914b9d751c
commit 9046fd897b

View File

@@ -229,13 +229,17 @@ async function getVideoInfo(videoID: string, session: any) {
if (argv.verbose) { if (argv.verbose) {
console.log(JSON.stringify(data, undefined, 2)); console.log(JSON.stringify(data, undefined, 2));
} }
for (const item of data["playbackUrls"]) { let playbackUrl = null;
if (item["mimeType"] == "application/vnd.apple.mpegurl") { try {
return item["playbackUrl"]; playbackUrl = data["playbackUrls"].filter(
} (item: { [x: string]: string; }) => item["mimeType"] == "application/vnd.apple.mpegurl")[0]["playbackUrl"];
} }
console.error("Error fetching hlsUrl"); catch (e) {
process.exit(27); console.error(`Error fetching hlsUrl: ${e}`);
process.exit(27);
}
return playbackUrl;
}) })
return [title, hlsUrl]; return [title, hlsUrl];