diff options
Diffstat (limited to 'server/tools/peertube-import-videos.ts')
-rw-r--r-- | server/tools/peertube-import-videos.ts | 11 |
1 files changed, 8 insertions, 3 deletions
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) { | |||
74 | 74 | ||
75 | let info = await getYoutubeDLInfo(youtubeDL, program['targetUrl'], command.args) | 75 | let info = await getYoutubeDLInfo(youtubeDL, program['targetUrl'], command.args) |
76 | 76 | ||
77 | if (info?.title === 'Uploads') { | 77 | if (!Array.isArray(info)) info = [ info ] |
78 | console.log('Fixing URL to %s.', info.url) | ||
79 | 78 | ||
80 | info = await getYoutubeDLInfo(youtubeDL, info.url, command.args) | 79 | // Try to fix youtube channels upload |
80 | const uploadsObject = info.find(i => !i.ie_key && !i.duration && i.title === 'Uploads') | ||
81 | |||
82 | if (uploadsObject) { | ||
83 | console.log('Fixing URL to %s.', uploadsObject.url) | ||
84 | |||
85 | info = await getYoutubeDLInfo(youtubeDL, uploadsObject.url, command.args) | ||
81 | } | 86 | } |
82 | 87 | ||
83 | let infoArray: any[] | 88 | let infoArray: any[] |