YouTube
Node-RED

YouTube

Shows your Youtube channel subscribers count. Also views count.
A flow by Tony Chang

Download flow Download assets

Flow Details

YouTube

Shows your Youtube channel subscribers count.
Also views count.

Icon

You may need downloading these two icons from Icon Database:
youtube
You may also use upload assets function in this page.

Usage

Just enter your Channel ID and Youtube API key in the [Data] node.
Set IP address of your Awtrix Light in the AwtrixLight/Custom node.

[ { "id": "79a1d588fb9a84cc", "type": "group", "z": "809eb5406b944369", "name": "App: Youtube", "style": { "label": true }, "nodes": [ "6d366e235bf5ec13", "87133e269f8de4b0", "7e2cb9773c4c2b9f", "4d837f3b56cf63fc", "fecb80f953bcd6f4", "cb4a8e19cab529db", "5a1799342bd0604e" ], "x": 14, "y": 919, "w": 992, "h": 202 }, { "id": "6d366e235bf5ec13", "type": "inject", "z": "809eb5406b944369", "g": "79a1d588fb9a84cc", "name": "1x/10min", "props": [ { "p": "topic", "vt": "str" } ], "repeat": "600", "crontab": "", "once": true, "onceDelay": "1", "topic": "youtube", "x": 120, "y": 1020, "wires": [ [ "fecb80f953bcd6f4" ] ] }, { "id": "87133e269f8de4b0", "type": "http request", "z": "809eb5406b944369", "g": "79a1d588fb9a84cc", "name": "YouTube API", "method": "GET", "ret": "obj", "paytoqs": "query", "url": "https://youtube.googleapis.com/youtube/v3/channels", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [ { "keyType": "User-Agent", "keyValue": "", "valueType": "other", "valueValue": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15" } ], "x": 470, "y": 1020, "wires": [ [ "7e2cb9773c4c2b9f" ] ] }, { "id": "7e2cb9773c4c2b9f", "type": "function", "z": "809eb5406b944369", "g": "79a1d588fb9a84cc", "name": "Parser", "func": "var statData = msg.payload.items[0].statistics;\nvar subscriberCount = String(statData.subscriberCount);\nvar viewCount = String(statData.viewCount)\n\nmsg.payload = [\n {\n \"text\": subscriberCount,\n \"icon\": \"youtube\",\n \"duration\": 10\n },\n {\n \"text\": viewCount,\n \"icon\": \"youtube\",\n \"color\": \"#00FF00\",\n \"duration\": 10\n }\n];\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 650, "y": 1020, "wires": [ [ "cb4a8e19cab529db" ] ] }, { "id": "4d837f3b56cf63fc", "type": "comment", "z": "809eb5406b944369", "g": "79a1d588fb9a84cc", "name": "Youtube", "info": "Just enter your **Channel ID** and **Youtube API key** in the **[Data]** node. \nSet IP address of your Awtrix Light in the **_AwtrixLight/Custom_** node. \nUses Icon 'youtube'.\n", "x": 120, "y": 960, "wires": [] }, { "id": "fecb80f953bcd6f4", "type": "function", "z": "809eb5406b944369", "g": "79a1d588fb9a84cc", "name": "Data", "func": "msg.payload = { \"id\": \"UCdxkMbirTsG0G63x3QUU8rg\", \"key\": \"<<PUT_YOUR_YOUTUBE_API_KEY_HERE>>\", \"part\":\"statistics\"}\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 290, "y": 1020, "wires": [ [ "87133e269f8de4b0" ] ] }, { "id": "cb4a8e19cab529db", "type": "http request", "z": "809eb5406b944369", "g": "79a1d588fb9a84cc", "name": "AwtrixLight/Custom", "method": "POST", "ret": "txt", "paytoqs": "body", "url": "http://10.10.10.192/api/custom?name=youtube", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [ { "keyType": "Content-Type", "keyValue": "", "valueType": "other", "valueValue": "application/json" } ], "x": 860, "y": 1020, "wires": [ [ "5a1799342bd0604e" ] ] }, { "id": "5a1799342bd0604e", "type": "debug", "z": "809eb5406b944369", "g": "79a1d588fb9a84cc", "name": "Response", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 900, "y": 1080, "wires": [] } ]
/flows/Xj8YOkPB5Ppx/youtube.gif
-- Flow first published on November 10, 2023, last updated on November 10, 2023 at 17:42.