aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tools/import-youtube.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/tools/import-youtube.ts b/server/tools/import-youtube.ts
index 68893306f..e51a66e5f 100644
--- a/server/tools/import-youtube.ts
+++ b/server/tools/import-youtube.ts
@@ -52,10 +52,16 @@ async function run () {
52 youtubeDL.getInfo(program['youtubeUrl'], options, processOptions, async (err, info) => { 52 youtubeDL.getInfo(program['youtubeUrl'], options, processOptions, async (err, info) => {
53 if (err) throw err 53 if (err) throw err
54 54
55 let infoArray: any[]
56
55 // Normalize utf8 fields 57 // Normalize utf8 fields
56 info = info.map(i => normalizeObject(i)) 58 if (Array.isArray(info) === true) {
59 infoArray = info.map(i => normalizeObject(i))
60 } else {
61 infoArray = [ normalizeObject(info) ]
62 }
57 63
58 const videos = info.map(i => { 64 const videos = infoArray.map(i => {
59 return { url: 'https://www.youtube.com/watch?v=' + i.id, name: i.title } 65 return { url: 'https://www.youtube.com/watch?v=' + i.id, name: i.title }
60 }) 66 })
61 67