+ let infoArray: any[]
+
+ infoArray = [].concat(info)
+ if (options.first) {
+ infoArray = infoArray.slice(0, options.first)
+ } else if (options.last) {
+ infoArray = infoArray.slice(-options.last)
+ }
+ // Normalize utf8 fields
+ infoArray = infoArray.map(i => normalizeObject(i))
+
+ log.info('Will download and upload %d videos.\n', infoArray.length)
+
+ for (const [ index, info ] of infoArray.entries()) {
+ try {
+ if (index > 0 && options.waitInterval) {
+ log.info("Wait for %d seconds before continuing.", options.waitInterval / 1000)
+ await new Promise(res => setTimeout(res, options.waitInterval))
+ }