Parsing data on a html website

#1

hello,

i'm trying to understand how to use the html node. i have some difficulties in parsing data from a html.
for exercise i'm trying to take some information from the website oraesattaco
i can't take the time and more in general i have some difficuties on every attribute that change

[{"id":"13f05733.be7349","type":"http request","z":"b2f1b60c.9e0988","name":"","method":"GET","ret":"txt","url":"https://www.oraesatta.co/","tls":"","x":1070,"y":120,"wires":[["ebdcef3b.c917d"]]},{"id":"1d24ba3b.c92936","type":"inject","z":"b2f1b60c.9e0988","name":"","topic":"trigg","payload":"gris","payloadType":"flow","repeat":"","crontab":"","once":false,"x":900,"y":120,"wires":[["13f05733.be7349"]]},{"id":"649d9b39.7a7874","type":"debug","z":"b2f1b60c.9e0988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1470,"y":120,"wires":[]},{"id":"ebdcef3b.c917d","type":"html","z":"b2f1b60c.9e0988","name":"","property":"","outproperty":"","tag":"#top-box > h1","ret":"html","as":"single","x":1260,"y":120,"wires":[["649d9b39.7a7874"]]},{"id":"9964e6e2.0df348","type":"http request","z":"b2f1b60c.9e0988","name":"worldonometers","method":"GET","ret":"txt","url":"https://www.oraesatta.co/","tls":"","x":1080,"y":180,"wires":[["e4256f52.38ffe"]]},{"id":"5e816bee.94e7c4","type":"debug","z":"b2f1b60c.9e0988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1470,"y":180,"wires":[]},{"id":"e4256f52.38ffe","type":"html","z":"b2f1b60c.9e0988","name":"","property":"","outproperty":"","tag":"#clock","ret":"text","as":"single","x":1230,"y":180,"wires":[["5e816bee.94e7c4"]]},{"id":"37f2414a.d90fbe","type":"inject","z":"b2f1b60c.9e0988","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":900,"y":180,"wires":[["9964e6e2.0df348"]]}]

i'm able to take string data.. but i'm not able to take data that change.. i'm not sure that this is the correct way.. How i have to do?

thank you for your help

0 Likes

#2

You cannot access data that is calculated on the web page by javascript. The html node fetches the source of the page but does not run the javascript.

0 Likes

#3

Thank you for your answer. Do you have any idea how I can get that calculated data? Is it possible in other way?

0 Likes

#4

Not that I am aware of, other than to work out what the js is doing and replicate that in a function node for example.

0 Likes

#5

I’ve not done it in Node-RED but if you google “scrape javascript tendered page” there are techniques using third party websites or python

0 Likes

#6

Thank you! I will try!

0 Likes

#7

A typo there I think, should be rendered possibly.

0 Likes

#8

yep, rendered ooooops!

0 Likes