import { move, pathExists, readdir, remove } from 'fs-extra'
import { dirname, join } from 'path'
+import { inspect } from 'util'
import { CONFIG } from '@server/initializers/config'
import { isVideoFileExtnameValid } from '../custom-validators/videos'
import { logger, loggerTagsFactory } from '../logger'
processOptions
})
+ if (!info) throw new Error(`YoutubeDL could not get info from ${this.url}`)
+
if (info.is_live === true) throw new Error('Cannot download a live streaming.')
const infoBuilder = new YoutubeDLInfoBuilder(info)
return infoBuilder.getInfo()
}
+ async getInfoForListImport (options: {
+ latestVideosCount?: number
+ }) {
+ const youtubeDL = await YoutubeDLCLI.safeGet()
+
+ const list = await youtubeDL.getListInfo({
+ url: this.url,
+ latestVideosCount: options.latestVideosCount,
+ processOptions
+ })
+
+ if (!Array.isArray(list)) throw new Error(`YoutubeDL could not get list info from ${this.url}: ${inspect(list)}`)
+
+ return list.map(info => info.webpage_url)
+ }
+
async getSubtitles (): Promise<YoutubeDLSubs> {
const cwd = CONFIG.STORAGE.TMP_DIR
return remove(path)
})
- .catch(innerErr => logger.error('Cannot remove file in youtubeDL timeout.', { innerErr, ...lTags() }))
+ .catch(innerErr => logger.error('Cannot remove file in youtubeDL error.', { innerErr, ...lTags() }))
throw err
}