From 9b8d341e5bd65ec07faefdd3b19c416928c0f5c7 Mon Sep 17 00:00:00 2001 From: WilliamWsyHK Date: Thu, 19 May 2022 21:54:06 +0800 Subject: [PATCH] Add `personal` to URL regex to apply to more sites (#437) * Add personal URL for new MS Teams recordings * Encode URI components to avoid unescape char --- src/ApiClient.ts | 2 +- src/Downloaders.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ApiClient.ts b/src/ApiClient.ts index 1bd4af7..a8dab50 100644 --- a/src/ApiClient.ts +++ b/src/ApiClient.ts @@ -175,7 +175,7 @@ export class ShareApiClient { AddRequiredFields: true } }; - const url = `${this.site}/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='${filePath}'`; + const url = `${this.site}/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='${encodeURIComponent(filePath)}'`; logger.verbose(`Requesting video info for '${url}'`); const info = await this.axiosInstance.post(url, payload, { diff --git a/src/Downloaders.ts b/src/Downloaders.ts index 6f35de1..c167e15 100644 --- a/src/Downloaders.ts +++ b/src/Downloaders.ts @@ -177,7 +177,7 @@ export async function downloadStreamVideo(videoUrls: Array): Promise): Promise { - const shareUrlRegex = new RegExp(/(?https:\/\/.+\.sharepoint\.com).*?(?\/(?:teams|sites)\/.*?)(?:(?\/.*\.mp4)|\/.*id=(?.*mp4))/); + const shareUrlRegex = new RegExp(/(?https:\/\/.+\.sharepoint\.com).*?(?\/(?:teams|sites|personal)\/.*?)(?:(?\/.*\.mp4)|\/.*id=(?.*mp4))/); logger.info('Downloading SharePoint videos...\n\n');