From 9dccceab1ceed2eb57562bb5f63ccf5f0ee03221 Mon Sep 17 00:00:00 2001 From: Balazs Toldi <6185741+Bazsalanszky@users.noreply.github.com> Date: Wed, 31 Mar 2021 11:13:39 +0200 Subject: [PATCH] Adding the ability to download channel videos --- src/Utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Utils.ts b/src/Utils.ts index 3d3036e..28cc0ac 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -11,7 +11,7 @@ import fs from 'fs'; async function extractGuids(url: string, client: ApiClient): Promise | null> { const videoRegex = new RegExp(/https:\/\/.*\/video\/(\w{8}-(?:\w{4}-){3}\w{12})/); - const groupRegex = new RegExp(/https:\/\/.*\/group\/(\w{8}-(?:\w{4}-){3}\w{12})/); + const groupRegex = new RegExp(/https:\/\/.*\/(group|channel)\/(\w{8}-(?:\w{4}-){3}\w{12})/); const videoMatch: RegExpExecArray | null = videoRegex.exec(url); const groupMatch: RegExpExecArray | null = groupRegex.exec(url); @@ -20,7 +20,7 @@ async function extractGuids(url: string, client: ApiClient): Promise | undefined) => response?.data.metrics.videos); const result: Array = []; @@ -28,7 +28,7 @@ async function extractGuids(url: string, client: ApiClient): Promise = await client.callApi( - `groups/${groupMatch[1]}/videos?$skip=${100 * index}&` + + `${groupMatch[1]}s/${groupMatch[2]}/videos?$skip=${100 * index}&` + '$top=100&$orderby=publishedDate asc', 'get') .then( (response: AxiosResponse | undefined) =>