[{"id":"91a0dc20.823f9","type":"http request","z":"bb7dc834.b72658","name":"Retrieve the CBC PEI RSS Feed","method":"GET","ret":"txt","url":"https://www.cbc.ca/cmlink/rss-canada-pei","tls":"","x":210,"y":120,"wires":[["7f322f50.e876e8"]]},{"id":"7f322f50.e876e8","type":"xml","z":"bb7dc834.b72658","name":"Convert RSS XML into JSON","property":"payload","attr":"att","chr":"text","x":200,"y":180,"wires":[["43ceda4b.0b85a4"]]},{"id":"6589b764.6d2db","type":"split","z":"bb7dc834.b72658","name":"Split each RSS item into a separate message","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":250,"y":300,"wires":[["b82cf5dc.af1538"]],"inputLabels":["msg.payload.rss.channel[0].item"]},{"id":"43ceda4b.0b85a4","type":"change","z":"bb7dc834.b72658","name":"Move RSS items array into msg.payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":240,"wires":[["6589b764.6d2db"]]},{"id":"b82cf5dc.af1538","type":"function","z":"bb7dc834.b72658","name":"Convert each RSS item to HTML.","func":"// We only want Prince Edward Island stories.\nif (msg.payload.category[0] == 'News/Canada/PEI') {\n msg.html = '

' + msg.payload.title[0] + '

';\n msg.html += '

' + msg.payload.description[0] + '

';\n}\nelse {\n msg.html = '';\n}\nreturn msg;","outputs":1,"noerr":0,"x":220,"y":360,"wires":[["430103fb.a16d54"]]},{"id":"5ccbddcb.dee054","type":"http in","z":"bb7dc834.b72658","name":"Receive HTTP request for /cbc.html","url":"/cbc.html","method":"get","upload":false,"swaggerDoc":"","x":220,"y":60,"wires":[["91a0dc20.823f9"]]},{"id":"ea15894c.cc2f6","type":"http response","z":"bb7dc834.b72658","name":"Return the HTML","statusCode":"","headers":{},"x":170,"y":540,"wires":[]},{"id":"430103fb.a16d54","type":"join","z":"bb7dc834.b72658","name":"Join all the HTML items into a single string","mode":"custom","build":"string","property":"html","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":250,"y":420,"wires":[["793288c3.8cd94"]]},{"id":"793288c3.8cd94","type":"function","z":"bb7dc834.b72658","name":"Add a header to the HTML","func":"html = '';\nhtml += '';\nhtml += '';\nhtml += 'CBC Prince Edward Island Headlines';\nhtml += '';\nhtml += '';\nhtml += '';\nmsg.html = html + msg.html + '';\nmsg.payload = msg.html;\nreturn msg;\n","outputs":1,"noerr":0,"x":200,"y":480,"wires":[["ea15894c.cc2f6"]]}]