!7 cm YouTubeDownloader { transient JTextArea ta; transient JTextField tfURL, tfDest; transient JButton btnGo; transient File lastFileMade; start { doEvery(1000, r updateMe); } visualize { tfURL = jtextfield("https://www.youtube.com/watch?v=YYOKMUTTDdA"); // Full paste componentPopupMenu_clear(tfURL); componentPopupMenuItem(tfURL, "Paste", r { tfURL.selectAll(); tfURL.paste() }); tfDest = jtextfield(desktopDir()); onEnter(tfURL, r go); ret northAndCenterWithMargins( vstackWithSpacing( centerAndEast(withLabel("Video URL to download:", tfURL), withLeftMargin(btnGo = jbutton("Download", r go))), withLabel("Destination directory:", tfDest)), ta = typeWriterTextArea()); } void unvisualize() { ta = null; } void update { if (ta != null) setText(ta, localPrintLog()); } void go { thread "YouTube Download" { temp tempDisableButton(btnGo); installOrUpdateYouTubeDL(); S url = /*formatYouTubeURL_long*/(gtt(tfURL)); File dir = newFile(gtt(tfDest)); S output = downloadImpl(url, dir); File f = youtubeDLExtractDestination(output); if (f != null) print("\nMade: " + fileInfo(lastFileMade = f)); else print("\nHmm. Did something go wrong?"); } } S downloadImpl(S url, File dir) { ret youtubeDownloadVideo(url, dir); } // API File downloadAndReturnFile(S url, File dir) enter { ret youtubeDLExtractDestination(downloadImpl(url, dir)); } }