Hello, I'm new to Node Red so I'm not quite sure how to extract correctly the data from web sites. I tried to retrieve data from http://www.bom.gov.au/nt/forecasts/darwin.shtml, but I got empty result. Could you please help me with this?
I used html selector as div#content>div.day.main>h2
This is my flow:
[
{
"id": "894c52497e20f993",
"type": "inject",
"z": "780c98709eb50e75",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 80,
"y": 140,
"wires": [
[
"d4b4012dd4ceaf6b"
]
]
},
{
"id": "d4b4012dd4ceaf6b",
"type": "http request",
"z": "780c98709eb50e75",
"name": "Weather ",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://www.bom.gov.au/nt/forecasts/darwin.shtml",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 260,
"y": 160,
"wires": [
[
"f38681f6d1ed532a"
]
]
},
{
"id": "f38681f6d1ed532a",
"type": "html",
"z": "780c98709eb50e75",
"name": "Today date",
"property": "payload",
"outproperty": "payload",
"tag": "div#content>div.day.main>h2",
"ret": "html",
"as": "single",
"x": 470,
"y": 160,
"wires": [
[
"72bf1c6b458cefff"
]
]
},
{
"id": "72bf1c6b458cefff",
"type": "function",
"z": "780c98709eb50e75",
"name": "Set date",
"func": "flow.set(\"today\",msg.payload)\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 650,
"y": 160,
"wires": [
[
"4dc6bef1bb065db3"
]
]
},
{
"id": "4dc6bef1bb065db3",
"type": "function",
"z": "780c98709eb50e75",
"name": "Combining 2",
"func": "var today = flow.get(\"today\");\nvar i;\nvar output = \"\";\nfor (i = 0; i < today.length; i++)\n{\n output += today[i];\n}\nmsg.payload = output;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 800,
"y": 240,
"wires": [
[
"4d4836bd2cec7c76"
]
]
},
{
"id": "4d4836bd2cec7c76",
"type": "debug",
"z": "780c98709eb50e75",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 320,
"wires": []
}
]
Thanks