Skip to content

Instantly share code, notes, and snippets.

@vico93
Created June 4, 2022 03:32
Show Gist options
  • Save vico93/6ccdfeb317620f6dfd452c71ca34967f to your computer and use it in GitHub Desktop.
Save vico93/6ccdfeb317620f6dfd452c71ca34967f to your computer and use it in GitHub Desktop.
#ciencia node-red flow
[
{
"id": "992ee185d38fe602",
"type": "tab",
"label": "#ciencia",
"disabled": false,
"info": "",
"env": []
},
{
"id": "8f918cf1536ada9e",
"type": "function",
"z": "992ee185d38fe602",
"name": "Prepara Webhook",
"func": "msg.description = msg.payload;\n\nmsg.payload = {\n \"content\": \":new::exclamation:▸ **\" + msg.article.title + \"**\\n:link:▸ \" + msg.article.link,\n \"username\": msg.article.author,\n \"avatar_url\": msg.avatar\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 630,
"y": 400,
"wires": [
[
"7eaadaa2e218d5da"
]
]
},
{
"id": "7eaadaa2e218d5da",
"type": "http request",
"z": "992ee185d38fe602",
"name": "Webhook",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://discord.com/api/webhooks/000/xxxx",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": false,
"x": 800,
"y": 400,
"wires": [
[
"115d02f62f40137b"
]
]
},
{
"id": "115d02f62f40137b",
"type": "function",
"z": "992ee185d38fe602",
"name": "Prepara Console",
"func": "msg.status = \"Novo item pro #ciencia: \";\n\nswitch (msg.statusCode) {\n case 200:\n msg.status = \"OK 200\";\n break;\n case 204:\n msg.status = \"OK 204\";\n break;\n default:\n msg.status = \"WTF!? \" + msg.statusCode;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1030,
"y": 400,
"wires": [
[
"ac830f99e52f200f"
]
]
},
{
"id": "ac830f99e52f200f",
"type": "debug",
"z": "992ee185d38fe602",
"name": "Console",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "status",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1200,
"y": 400,
"wires": []
},
{
"id": "d9e7f5f7f11880aa",
"type": "comment",
"z": "992ee185d38fe602",
"name": "Webhook",
"info": "",
"x": 720,
"y": 360,
"wires": []
},
{
"id": "ab63c206e8b66463",
"type": "comment",
"z": "992ee185d38fe602",
"name": "Debug & Console",
"info": "",
"x": 1100,
"y": 360,
"wires": []
},
{
"id": "dfca508c1cde3b51",
"type": "delay",
"z": "992ee185d38fe602",
"name": "Rate Limit",
"pauseType": "delay",
"timeout": "1",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 460,
"y": 400,
"wires": [
[
"8f918cf1536ada9e"
]
]
},
{
"id": "628d2a3d541c512c",
"type": "feedparse",
"z": "992ee185d38fe602",
"name": "SpaceToday",
"url": "https://www.youtube.com/feeds/videos.xml?channel_id=UC_Fk7hHbl7vv_7K8tYqJd5A",
"interval": "30",
"ignorefirst": true,
"x": 90,
"y": 280,
"wires": [
[
"f73d99c3b65a7a67"
]
]
},
{
"id": "f73d99c3b65a7a67",
"type": "function",
"z": "992ee185d38fe602",
"name": "",
"func": "msg.avatar = \"https://yt3.ggpht.com/ytc/AKedOLRVEwS5mCiA9vVi9gGUVawqDPterHYYmoKqdws=s88-c-k-c0x00ffffff-no-rj\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 260,
"y": 280,
"wires": [
[
"dfca508c1cde3b51"
]
]
},
{
"id": "ebb58f2fb0dcb917",
"type": "comment",
"z": "992ee185d38fe602",
"name": "Feed (e avatar)",
"info": "",
"x": 200,
"y": 240,
"wires": []
},
{
"id": "393c3f94ade1717c",
"type": "feedparse",
"z": "992ee185d38fe602",
"name": "Ciência Todo Dia",
"url": "https://www.youtube.com/feeds/videos.xml?channel_id=UCn9Erjy00mpnWeLnRqhsA1g",
"interval": "30",
"ignorefirst": true,
"x": 100,
"y": 320,
"wires": [
[
"d07f684743b48a46"
]
]
},
{
"id": "d07f684743b48a46",
"type": "function",
"z": "992ee185d38fe602",
"name": "",
"func": "msg.avatar = \"https://yt3.ggpht.com/ytc/AKedOLRPqSvwTqTdMzwWt6FHZYvGqUjRbEfH_fiQyeAz2A=s88-c-k-c0x00ffffff-no-rj\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 260,
"y": 320,
"wires": [
[
"dfca508c1cde3b51"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment