static DownloadedMedia downloadAudio(S url) { File dir = downloadedAudioDir(); S extension = ".opus"; S fn = md5FileName(url); File infoFile = newFile(dir, fn + ".info"); DownloadedMedia dm = new(null, loadTextFile(infoFile), extension); if (fileExists(dm!)) ret dm; saveTextFile(newFile(dir, fn + ".url"), url); S options = "-U --no-playlist --no-mtime --write-description --write-info-json" + " --write-annotations --write-thumbnail --print-json --restrict-filenames"; options += " -x"; // audio only options += " --audio-format opus"; // demand opus S cmd = pqO(installYouTubeDL()) + " " + options + " -o " + pqO(newFile(dir, youTubeDLDefaultFileNameTemplate())) + " " + pqO(url); S output = backtick_verbose(cmd); saveTextFile(infoFile, output); ret new DownloadedMedia(cmd, output, extension); }