import { ApiClient } from './ApiClient'; import { promptUser } from './CommandLineParser'; import { logger } from './Logger'; import { Video, Session } from './Types'; import { AxiosResponse } from 'axios'; import fs from 'fs'; import { parse } from 'iso8601-duration'; import path from 'path'; import sanitize from 'sanitize-filename'; function publishedDateToString(date: string): string { const dateJs: Date = new Date(date); const day: string = dateJs.getDate().toString().padStart(2, '0'); const month: string = (dateJs.getMonth() + 1).toString(10).padStart(2, '0'); return `${dateJs.getFullYear()}-${month}-${day}`; } function durationToTotalChunks(duration: string): number { const durationObj: any = parse(duration); const hrs: number = durationObj.hours ?? 0; const mins: number = durationObj.minutes ?? 0; const secs: number = Math.ceil(durationObj.seconds ?? 0); return (hrs * 60) + mins + (secs / 60); } export async function getVideoInfo(videoGuids: Array, session: Session, subtitles?: boolean): Promise> { let metadata: Array