I'm trying to show some rss feeds on the dashboard. The feeds are from a news website. The amount of items in the feed can thus change.
What I did so far is use the feedparser node then a change node to just get the titles. Since each article is a different message, I merge them all to get an array. I run a javascript function on it to count the number items in the array. From there, I'm stuck. I think need to put those array elements in a template and repeat this the amount of times the javascript counter calculated.
This is the current flow:
[
{
"id": "716b6b70.7a8f14",
"type": "feedparse",
"z": "1ec2e29b.126add",
"name": "feeds",
"url": "https://www.vrt.be/vrtnws/nl.rss.headlines.xml",
"interval": 15,
"x": 70,
"y": 200,
"wires": [
[
"c73ab36f.e0ab5"
]
]
},
{
"id": "c73ab36f.e0ab5",
"type": "change",
"z": "1ec2e29b.126add",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "article.title",
"tot": "msg"
},
{
"t": "delete",
"p": "article",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 240,
"y": 200,
"wires": [
[
"db4fb300.0097d"
]
]
},
{
"id": "db4fb300.0097d",
"type": "merge",
"z": "1ec2e29b.126add",
"name": "",
"timeout": "5",
"x": 410,
"y": 200,
"wires": [
[
"8b28ef44.7d053",
"a622c81d.debf68"
]
]
},
{
"id": "bf1a6c22.bb636",
"type": "debug",
"z": "1ec2e29b.126add",
"name": "Counter",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 760,
"y": 260,
"wires": []
},
{
"id": "8b28ef44.7d053",
"type": "function",
"z": "1ec2e29b.126add",
"name": "Count Messages",
"func": "var MessageCount = { payload: msg.payload.length };\nreturn MessageCount;",
"outputs": 1,
"noerr": 0,
"x": 570,
"y": 260,
"wires": [
[
"bf1a6c22.bb636"
]
]
},
{
"id": "a622c81d.debf68",
"type": "debug",
"z": "1ec2e29b.126add",
"name": "Array",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 550,
"y": 200,
"wires": []
}
]