RSS Creation in NODERED

Hi there!

I would like to create an own RSS feed, containing magnet links, something like on showrss.info .

But I want to be able to add a new item entry to this RSS feed from my phone.

None of these 2 processes I know how to, can anyone explain where to start?

Thx,
Aaron

I have created an example flow that provides 2 endpoints

http://node-red-ip:1880/updaterss to add an item to the feed using a form
http://node-red-ip:1880/rss that creates the rss feed.

When adding an entry via /updaterss it uses a flow variable (need to store it somewhere), it gets the existing elements and adds+saves the new array.

The /rss can be used in other applications that read it.

Flow:

[{"id":"50ffec09.ee977c","type":"xml","z":"a767d395.f10e8","name":"","property":"payload","attr":"","chr":"","x":458,"y":744,"wires":[["c2f07ad7.383c88"]]},{"id":"1919a48a.b9c35b","type":"function","z":"a767d395.f10e8","name":"","func":"items = flow.get(\"items\")\n\n// required elements for rss feed\ndescription = {\n    \"title\":  \"Your feed title\",\n    \"link\": \"http://yoururl\",\n    \"description\": \"my RSS feed\"\n}\n\n\n\nmsg.payload = {\n  \"rss\": {\n    \"$\": {\n      \"version\": \"2.0\"\n    },\n    \"channel\": description,\n    \"item\":items\n  }\n}\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":324,"y":744,"wires":[["50ffec09.ee977c"]]},{"id":"1cbee66a.960cb2","type":"http in","z":"a767d395.f10e8","name":"","url":"/rss","method":"get","upload":false,"swaggerDoc":"","x":180,"y":744,"wires":[["1919a48a.b9c35b"]]},{"id":"132a8898.59d577","type":"http response","z":"a767d395.f10e8","name":"","statusCode":"","headers":{},"x":602,"y":840,"wires":[]},{"id":"152226cc.51ce39","type":"http in","z":"a767d395.f10e8","name":"","url":"/updaterss","method":"get","upload":false,"swaggerDoc":"","x":200,"y":864,"wires":[["33f934d9.35718c","20a7a02a.24b75"]]},{"id":"33f934d9.35718c","type":"template","z":"a767d395.f10e8","name":"","field":"payload","fieldType":"msg","format":"html","syntax":"plain","template":"<form>\n  <label for=\"title\">Title</label><br>\n  <input type=\"text\" id=\"title\" name=\"title\"><br>\n  <label for=\"link\">Link</label><br>\n  <input type=\"text\" id=\"link\" name=\"link\"><br>\n  <label for=\"description\">Description</label><br>\n  <input type=\"text\" id=\"description\" name=\"description\">\n  <br>\n  <input type=\"submit\">\n</form>","output":"str","x":396,"y":840,"wires":[["132a8898.59d577"]]},{"id":"20a7a02a.24b75","type":"switch","z":"a767d395.f10e8","name":"","property":"req.query","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":386,"y":888,"wires":[["ca750acd.4fc448"]]},{"id":"ca750acd.4fc448","type":"function","z":"a767d395.f10e8","name":"","func":"items = flow.get(\"items\") || []\n\nm = msg.req.query\nt = m.title\nl = m.link\nd = m.description\n\nitems.push({title:t,link:l,description:d})\n\nflow.set(\"items\",items)\n\nreturn null","outputs":1,"noerr":0,"initialize":"","finalize":"","x":471,"y":888,"wires":[[]],"l":false},{"id":"3692a1af.9f00de","type":"comment","z":"a767d395.f10e8","name":"Update function node with details","info":"","x":260,"y":696,"wires":[]},{"id":"c2f07ad7.383c88","type":"http response","z":"a767d395.f10e8","name":"","statusCode":"","headers":{"content-type":"application/xml"},"x":602,"y":744,"wires":[]}]
1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.