RSS feed on dashboard

Hi guys,

I'm new with node-red, I want to display RSS feeds on dashboard, but so far I can only display last feed not all, I was trying use template and text. No luck so far, should I use loop?

[{"id":"1a287e46.6039fa","type":"ui_template","z":"e8db5bfc.e69288","group":"8c8d1686.82337","name":"","order":1,"width":0,"height":0,"format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":966.6666870117188,"y":195.83334350585938,"wires":[[]]},{"id":"8c8d1686.82337","type":"ui_group","z":"","name":"RSS","tab":"43b3d1f8.d20da8","disp":true,"width":"6","collapse":false},{"id":"43b3d1f8.d20da8","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Regards

Unfortunately your flow isn't currently importable.Please read the following post How to share code or flow json and then edit the above message.

1 Like

Take a look at this example of how to build a table.

You will also need to add a debug node to your RSS feed to see how the data coming out is formatted

1 Like

I think I'm doing something wrong, bacuse now with

<table id="table" >
 <tr>
    <th>content</th> 
  </tr>
 <tbody>
 <tr ng-repeat="row in msg.payload">
    <td ng-repeat="item in row" >{{item}}</td>
 </tr>
 </tbody>
</table>

Nothing displayed, only content but not articles. My feed format is just string like
"string"


[{"id":"1a287e46.6039fa","type":"ui_template","z":"e8db5bfc.e69288","group":"8c8d1686.82337","name":"","order":1,"width":"0","height":"0","format":"<table id=\"table\" >\n <tr>\n    <th>content</th> \n  </tr>\n <tbody>\n <tr ng-repeat=\"row in msg.payload\">\n    <td ng-repeat=\"item in row\" >{{item}}</td>\n </tr>\n </tbody>\n</table>","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":665.6666870117188,"y":249.83334350585938,"wires":[[]]},{"id":"8c8d1686.82337","type":"ui_group","z":"","name":"RSS","tab":"43b3d1f8.d20da8","disp":true,"width":"6","collapse":false},{"id":"43b3d1f8.d20da8","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Without seeing what the input is, there is no way to know what is going on.

OK, this is my input

{"topic":"https://www.bbc.co.uk/news/stories-48736937","payload":"A man who may have seen the Isdal Woman on the way to her death; a police officer bitter that the case was shut down - new leads in a 49-year-old puzzle.","article":{"title":"Death in Ice Valley: New clues in Isdal Woman mystery","description":"A man who may have seen the Isdal Woman on the way to her death; a police officer bitter that the case was shut down - new leads in a 49-year-old puzzle.","summary":"A man who may have seen the Isdal Woman on the way to her death; a police officer bitter that the case was shut down - new leads in a 49-year-old puzzle.","date":"2019-06-24T23:36:52.000Z","pubdate":"2019-06-24T23:36:52.000Z","pubDate":"2019-06-24T23:36:52.000Z","link":"https://www.bbc.co.uk/news/stories-48736937","guid":"https://www.bbc.co.uk/news/stories-48736937","author":null,"comments":null,"origlink":null,"image":{},"source":{},"categories":[],"enclosures":[],"rss:@":{},"rss:title":{"@":{},"#":"Death in Ice Valley: New clues in Isdal Woman mystery"},"rss:description":{"@":{},"#":"A man who may have seen the Isdal Woman on the way to her death; a police officer bitter that the case was shut down - new leads in a 49-year-old puzzle."},"rss:link":{"@":{},"#":"https://www.bbc.co.uk/news/stories-48736937"},"permalink":"https://www.bbc.co.uk/news/stories-48736937","rss:guid":{"@":{"ispermalink":"true"},"#":"https://www.bbc.co.uk/news/stories-48736937"},"rss:pubdate":{"@":{},"#":"Mon, 24 Jun 2019 23:36:52 GMT"},"meta":{"#ns":[{"xmlns:dc":"http://purl.org/dc/elements/1.1/"},{"xmlns:content":"http://purl.org/rss/1.0/modules/content/"},{"xmlns:atom":"http://www.w3.org/2005/Atom"},{"xmlns:media":"http://search.yahoo.com/mrss/"}],"@":[{"xmlns:dc":"http://purl.org/dc/elements/1.1/"},{"xmlns:content":"http://purl.org/rss/1.0/modules/content/"},{"xmlns:atom":"http://www.w3.org/2005/Atom"},{"xmlns:media":"http://search.yahoo.com/mrss/"}],"#xml":{"version":"1.0","encoding":"UTF-8"},"#type":"rss","#version":"2.0","title":"BBC News - World","description":"BBC News - World","date":"2019-06-26T11:57:44.000Z","pubdate":"2019-06-26T11:57:44.000Z","pubDate":"2019-06-26T11:57:44.000Z","link":"https://www.bbc.co.uk/news/","xmlurl":null,"xmlUrl":null,"author":null,"language":"en-gb","favicon":null,"copyright":"Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/2/hi/help/rss/4498287.stm for terms and conditions of reuse.","generator":"RSS for Node","cloud":{},"image":{"url":"https://news.bbcimg.co.uk/nol/shared/img/bbc_news_120x60.gif","title":"BBC News - World"},"categories":[],"rss:@":{},"rss:title":{"@":{},"#":"BBC News - World"},"rss:description":{"@":{},"#":"BBC News - World"},"rss:link":{"@":{},"#":"https://www.bbc.co.uk/news/"},"rss:image":{"@":{},"url":{"@":{},"#":"https://news.bbcimg.co.uk/nol/shared/img/bbc_news_120x60.gif"},"title":{"@":{},"#":"BBC News - World"},"link":{"@":{},"#":"https://www.bbc.co.uk/news/"}},"rss:generator":{"@":{},"#":"RSS for Node"},"rss:lastbuilddate":{"@":{},"#":"Wed, 26 Jun 2019 11:57:44 GMT"},"rss:copyright":{"@":{},"#":"Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/2/hi/help/rss/4498287.stm for terms and conditions of reuse."},"rss:language":{"@":{},"#":"en-gb"},"rss:ttl":{"@":{},"#":"15"}}},"_msgid":"e8f9d8b5.9ead98"}

You are sending an object not an array which the example uses

That also only shows one article so that's all there is to display

How can I turn this to json array?

You will have to convert it somehow maybe with a function node. You will only get one row in the output as it stands now.

Lets take a step back...

The debug output you posted only has one post, so assuming you still want to display more than one post, you need to fix that problem first. How are you getting the RSS feed into Node-RED?

Using feedparser

the feedpasser node only passes on new entries (as described in its readme)

So you could get zero, 1 or many results.

If you want the last 5 entries you would be better off using the http request node.

1 Like

thank you, Ok, so I did try http request

image
and now my payload looks like:

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <title><![CDATA[BBC News - World]]></title> <description><![CDATA[BBC News - World]]></description> <link>https://www.bbc.co.uk/news/</link> <image> <url>https://news.bbcimg.co.uk/nol/shared/img/bbc_news_120x60.gif</url> <title>BBC News - World</title> <link>https://www.bbc.co.uk/news/</link> </image> <generator>RSS for Node</generator> <lastBuildDate>Wed, 26 Jun 2019 15:03:53 GMT</lastBuildDate> <copyright><![CDATA[Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/2/hi/help/rss/4498287.stm for terms and conditions...

And I can display all on page like
image

Could you please tell me how can I format xml? Should I use xml node for that?

well you could try…

Although I thought this was to be in the dashboard so I don’t understand you starting with a http-in node

you need to convert it to json first.

[{"id":"f5210d2.8ffd7f","type":"http request","z":"3d008345.b17004","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"http://feeds.bbci.co.uk/news/uk/rss.xml","tls":"","proxy":"","authType":"basic","x":290,"y":506,"wires":[["d583ab3e.28aa48"]]},{"id":"d583ab3e.28aa48","type":"xml","z":"3d008345.b17004","name":"","property":"payload","attr":"","chr":"","x":446,"y":506,"wires":[["5dcd9d6b.764294"]]},{"id":"6a0d0355.8354ac","type":"inject","z":"3d008345.b17004","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":132,"y":506,"wires":[["f5210d2.8ffd7f"]]},{"id":"5dcd9d6b.764294","type":"debug","z":"3d008345.b17004","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":616,"y":506,"wires":[]}]