From 5721fd8374e732c4dfa149c54a800db74591c245 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Dec 2020 09:54:38 +0100 Subject: Fix channels import with a channel with playlists --- server/tools/peertube-import-videos.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 1b2c63af2..5fc5a867c 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -74,10 +74,15 @@ async function run (url: string, user: UserInfo) { let info = await getYoutubeDLInfo(youtubeDL, program['targetUrl'], command.args) - if (info?.title === 'Uploads') { - console.log('Fixing URL to %s.', info.url) + if (!Array.isArray(info)) info = [ info ] - info = await getYoutubeDLInfo(youtubeDL, info.url, command.args) + // Try to fix youtube channels upload + const uploadsObject = info.find(i => !i.ie_key && !i.duration && i.title === 'Uploads') + + if (uploadsObject) { + console.log('Fixing URL to %s.', uploadsObject.url) + + info = await getYoutubeDLInfo(youtubeDL, uploadsObject.url, command.args) } let infoArray: any[] -- cgit v1.2.3