- // Normalize utf8 fields
- if (Array.isArray(info) === true) {
- infoArray = info.map(i => normalizeObject(i))
- } else {
- infoArray = [ normalizeObject(info) ]
- }
- console.log('Will download and upload %d videos.\n', infoArray.length)
+ // 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[]
+
+ // Normalize utf8 fields
+ infoArray = [].concat(info)
+ if (program['first']) {
+ infoArray = infoArray.slice(0, program['first'])
+ } else if (program['last']) {
+ infoArray = infoArray.slice(-program['last'])
+ }
+ infoArray = infoArray.map(i => normalizeObject(i))
+
+ log.info('Will download and upload %d videos.\n', infoArray.length)