From 0c65ff7dfef59c352a6d18cf30c3d490d582a8c6 Mon Sep 17 00:00:00 2001 From: Luca Armaroli Date: Sat, 5 Sep 2020 12:42:47 +0200 Subject: [PATCH] added parsing of m3u8 file down to a list of links --- src/Utils.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Utils.ts b/src/Utils.ts index 500b92f..910c9e8 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -179,6 +179,13 @@ export function checkOutDir(directory: string): boolean { } +export async function getUrlsFromPlaylist(playlistUrl: string, session: Session): Promise> { + return await ApiClient.getInstance(session).callUrl(playlistUrl, 'get', null, 'text') + .then(res => (res?.data as string).split(/\r?\n/) + .filter(line => !(line.startsWith('#') || line === ''))); +} + + export function checkRequirements(): void { try { const ffmpegVer: string = execSync('ffmpeg -version').toString().split('\n')[0];