Download Jar. Uses 3874K of libraries. Click here for Pure Java version (7829L/55K).
1 | !7 |
2 | |
3 | sS channel = "https://www.youtube.com/channel/UCSvK6EfxnMTajbe-Qpc6NvA"; |
4 | static YouTubeChannelInfo info; |
5 | static JLabel lbl, lbl2, lblChannel, lblSeconds; |
6 | static JSpinner spinner; |
7 | static int seconds = 1000; |
8 | sS url = "https://console.developers.google.com/projectselector/iam-admin/iam"; |
9 | |
10 | p-noconsole {
|
11 | load('channel);
|
12 | final JTextField tfChannel = jtextfield(channel); |
13 | final JTextField pfKey = jpassword(youTubeDataAPIKeyOpt()); |
14 | |
15 | renameSubmitButton("Start Live Counter", showFormTitled("Select YouTube Channel & enter API key",
|
16 | jrightalignedlabel("Channel URL"), tfChannel,
|
17 | jrightalignedlabel("YouTube Data API Key"), pfKey,
|
18 | "", "", |
19 | jrightalignedlabel("Get a YouTube Data API Key here:"),
|
20 | centerAndEast(juneditabletextfield(url), |
21 | jbutton("Open", r { openBrowser(url) })),
|
22 | "", "", r {
|
23 | youTubeDataAPIKey(getTextTrim(pfKey)); |
24 | start(getTextTrim(tfChannel)); |
25 | })); |
26 | } |
27 | |
28 | svoid start(S channel) {
|
29 | setAndSave(channel := channel); |
30 | swingFontScale(2); |
31 | info = youTubeChannelInfo(channel); |
32 | spinner = jspinner(10, 1, 60); |
33 | ImageSurface is = showBigText("Subscribers!", f getSubscribers, 1000).is;
|
34 | addToWindowNorth(is, lblChannel = jcenteredlabel("Channel: " + info.title));
|
35 | moveToTopRightCorner(addToWindowPack(is, vstack(lbl = jcenteredlabel(), lbl2 = jcenteredlabel(), |
36 | withTopMargin(20, jcenteredline(jsmalllabel("Update every"), spinner, lblSeconds = jsmalllabel("seconds"))))));
|
37 | } |
38 | |
39 | sS[] getSubscribers() {
|
40 | int s = intFromSpinner(spinner); |
41 | setText(lblSeconds, s == 1 ? "second" : "seconds"); |
42 | if (seconds++ < s) null; |
43 | seconds = 0; |
44 | YouTubeStats stats = youTubeStats(channel); |
45 | setText(lbl, "Views: " + stats.views); |
46 | setText(lbl2, "Videos: " + stats.videos); |
47 | ret new S[] { n(stats.subs, "sub"), n(stats.subs, "Sub") };
|
48 | } |
49 | |
50 | static JLabel jsmalllabel(S text) { ret setFontSize(15, jlabel(text)); } |
Began life as a copy of #1009889
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009890 |
| Snippet name: | YouTube Live Subscriber Count [OK with key] |
| Eternal ID of this version: | #1009890/54 |
| Text MD5: | 97bc795f659c5a6a3dae55fd79289184 |
| Transpilation MD5: | b6c161eda2d01d5dea86f7347675f054 |
| Author: | stefan |
| Category: | javax / networking |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-08-24 03:39:43 |
| Source code size: | 1920 bytes / 50 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1090 / 3288 |
| Version history: | 53 change(s) |
| Referenced in: | [show references] |