Replacing text in multiple items from RSS Feed - only listing first item


I’m very new to n8n and loving it. My coding skills are very basic though.

I am using an RSS Feed Read node to bring data into a Function node.

I want to replace some text from the contentSnippet field for all items, however the code I have created only brings in the first item.

I realise that is because my code contains $item(0) - and that $item(1) would bring in the next item - but I am not sure how to fix my code so that it lists all items in the output.

Thanks in advance!

var p = $item(0).$node["RSS Feed Read"].json["contentSnippet"];

var x = p.replace("More information",'');

for (item of items) {
  item.json.snippy = x.replace("Add to calendar: iCal",'');

Welcome to the community @Glean!

One short question first, is the Function-Node directly the first node after the RSS Feed one? Because then you can do something like this:

for (item of items) {
  item.json.snippy = item.json.contentSnippet.replace("More information",'').replace("Add to calendar: iCal",'');

return items;

That works perfectly, thanks Jan!

I hope I can ask another question - if I am using a Cron node, do I need to have the n8n app open on my desktop for the workflow to execute? What other options are there for sending it automatically?

Hey @Glean,

You would need to keep the desktop app opened, if you wanted to keep it running without needing to keep the window open at the moment the best options would be to install using docker or by taking the n8n cloud route.

If you have a Pi sat on the side somewhere not doing anything you can run n8n on that as well.

Thanks so much Jon,

If n8n is running on my laptop which goes to sleep, is there a way to wake up the computer to execute the workflow? The only solution I can find is to use Task Scheduler.