Flow Details
Just enter your Youtube API key, channelID in the config node and set your AWTRIX MQTT prefix.
[
{
"id": "a406753ae31eae57",
"type": "group",
"z": "54b42d8d.cda474",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"f0f17299.3736c",
"dc7878f9.4756c8",
"f234aae371d72680",
"555bb8624b88c9c3",
"69c388146e28049d",
"a349ade5a57f7537"
],
"x": 34,
"y": 39,
"w": 892,
"h": 122
},
{
"id": "f0f17299.3736c",
"type": "inject",
"z": "54b42d8d.cda474",
"g": "a406753ae31eae57",
"name": "",
"props": [],
"repeat": "600",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 130,
"y": 120,
"wires": [
[
"a349ade5a57f7537"
]
]
},
{
"id": "dc7878f9.4756c8",
"type": "http request",
"z": "54b42d8d.cda474",
"g": "a406753ae31eae57",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": "query",
"url": "https://youtube.googleapis.com/youtube/v3/channels",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 410,
"y": 120,
"wires": [
[
"f234aae371d72680"
]
]
},
{
"id": "f234aae371d72680",
"type": "function",
"z": "54b42d8d.cda474",
"g": "a406753ae31eae57",
"name": "parser",
"func": "var json = msg.payload;\nvar subscriberCount = json.items[0].statistics.subscriberCount;\n\nmsg.payload = {\"text\": subscriberCount, \"icon\": \"youtube\"};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 120,
"wires": [
[
"555bb8624b88c9c3"
]
]
},
{
"id": "555bb8624b88c9c3",
"type": "mqtt out",
"z": "54b42d8d.cda474",
"g": "a406753ae31eae57",
"name": "",
"topic": "awtrix/custom/youtube",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "346df2a95aac5785",
"x": 800,
"y": 120,
"wires": []
},
{
"id": "69c388146e28049d",
"type": "comment",
"z": "54b42d8d.cda474",
"g": "a406753ae31eae57",
"name": "Youtube Follower",
"info": "Just enter your Youtube API key and channelID and set your AWTRIX MQTT prefix. ",
"x": 140,
"y": 80,
"wires": []
},
{
"id": "a349ade5a57f7537",
"type": "function",
"z": "54b42d8d.cda474",
"g": "a406753ae31eae57",
"name": "Data",
"func": "msg.payload = { \"id\": \"XXXX\", \"key\": \"XXXX\", \"part\":\"statistics\"}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 270,
"y": 120,
"wires": [
[
"dc7878f9.4756c8"
]
]
},
{
"id": "346df2a95aac5785",
"type": "mqtt-broker",
"name": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]
-- Flow first published on May 10, 2023, last updated on May 10, 2023 at 08:34.