!7 sS channel = "https://www.youtube.com/channel/UCSvK6EfxnMTajbe-Qpc6NvA"; static YouTubeChannelInfo info; static JLabel lbl, lbl2, lblChannel, lblSeconds; static JSpinner spinner; static int seconds = 1000; sS url = "https://console.developers.google.com/projectselector/iam-admin/iam"; p-noconsole { load('channel); final JTextField tfChannel = jtextfield(channel); final JTextField pfKey = jpassword(youTubeDataAPIKeyOpt()); renameSubmitButton("Start Live Counter", showFormTitled("Select YouTube Channel & enter API key", jrightalignedlabel("Channel URL"), tfChannel, jrightalignedlabel("YouTube Data API Key"), pfKey, "", "", jrightalignedlabel("Get a YouTube Data API Key here:"), centerAndEast(juneditabletextfield(url), jbutton("Open", r { openBrowser(url) })), "", "", r { youTubeDataAPIKey(getTextTrim(pfKey)); start(getTextTrim(tfChannel)); })); } svoid start(S channel) { setAndSave(channel := channel); swingFontScale(2); info = youTubeChannelInfo(channel); spinner = jspinner(10, 1, 60); ImageSurface is = showBigText("Subscribers!", f getSubscribers, 1000).is; addToWindowNorth(is, lblChannel = jcenteredlabel("Channel: " + info.title)); moveToTopRightCorner(addToWindowPack(is, vstack(lbl = jcenteredlabel(), lbl2 = jcenteredlabel(), withTopMargin(20, jcenteredline(jsmalllabel("Update every"), spinner, lblSeconds = jsmalllabel("seconds")))))); } sS[] getSubscribers() { int s = intFromSpinner(spinner); setText(lblSeconds, s == 1 ? "second" : "seconds"); if (seconds++ < s) null; seconds = 0; YouTubeStats stats = youTubeStats(channel); setText(lbl, "Views: " + stats.views); setText(lbl2, "Videos: " + stats.videos); ret new S[] { n(stats.subs, "sub"), n(stats.subs, "Sub") }; } static JLabel jsmalllabel(S text) { ret setFontSize(15, jlabel(text)); }