Can't get href from HTML selector node

Hello ,
I need to scrap a website data ( productName, productCategory, productPrice ) .
I have done all those items , still just to get the href from a tag .

  • The website contain multiple links to be scrapped .
    Im using injectNode -->HTTP Get -->HTML Selector -->debug .
    Can you please support how can I get href using HTML selector node .

Thank you.

Welcome to the forum @arduino

You can export your Node-red flow (from the hamburger menu) and post it here using the </> button.
You can tell us the URL of the website you are seeking to scrape data from.
You can show us the output you are currently getting.

WIthout any of those things it's not easy to help.

Thank jbudd for your reply .

[{"id":"c151e39cb3680769","type":"tab","label":"Web Scarpping","disabled":false,"info":"","env":[]},{"id":"b3e1e48f764ee301","type":"inject","z":"c151e39cb3680769","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":180,"wires":[["aeb75201ebb12ab8"]]},{"id":"aeb75201ebb12ab8","type":"http request","z":"c151e39cb3680769","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://shop4makers.com/produit/capteur-tof-de-distance-vl6180x/","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":270,"y":300,"wires":[["3569b6490a7f33ec","94813323991c69f9","fdf44f74be292a5d","c2374ee4dd10df39","7a31b877a7f84d8b","ebef5a76010e6912"]]},{"id":"647ace372ae75ec7","type":"debug","z":"c151e39cb3680769","name":"debug 27","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":220,"wires":[]},{"id":"3569b6490a7f33ec","type":"html","z":"c151e39cb3680769","name":"availibility","property":"payload","outproperty":"payload","tag":"span.electro-stock-availability p","ret":"text","as":"single","x":500,"y":220,"wires":[["647ace372ae75ec7"]]},{"id":"9c9b936c8ec1ee20","type":"debug","z":"c151e39cb3680769","name":"debug 28","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":260,"wires":[]},{"id":"94813323991c69f9","type":"html","z":"c151e39cb3680769","name":"productName","property":"payload","outproperty":"payload","tag":"div.summary.entry-summary h1","ret":"text","as":"single","x":520,"y":260,"wires":[["9c9b936c8ec1ee20"]]},{"id":"5e32f9da1d68dfe3","type":"debug","z":"c151e39cb3680769","name":"debug 29","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":300,"wires":[]},{"id":"fdf44f74be292a5d","type":"html","z":"c151e39cb3680769","name":"currentPrice","property":"payload","outproperty":"payload","tag":"p.price>span>ins","ret":"text","as":"single","x":510,"y":300,"wires":[["5e32f9da1d68dfe3"]]},{"id":"e54aea7a7074b59c","type":"debug","z":"c151e39cb3680769","name":"debug 30","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":340,"wires":[]},{"id":"c2374ee4dd10df39","type":"html","z":"c151e39cb3680769","name":"categories","property":"payload","outproperty":"payload","tag":"div.summary.entry-summary>span","ret":"text","as":"single","x":510,"y":340,"wires":[["e54aea7a7074b59c"]]},{"id":"7a31b877a7f84d8b","type":"html","z":"c151e39cb3680769","name":"oldPrice","property":"payload","outproperty":"payload","tag":"p.price del","ret":"text","as":"single","x":500,"y":380,"wires":[["e26a33a292356604"]]},{"id":"e26a33a292356604","type":"debug","z":"c151e39cb3680769","name":"debug 31","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":380,"wires":[]},{"id":"ebef5a76010e6912","type":"html","z":"c151e39cb3680769","name":"productDescription","property":"payload","outproperty":"payload","tag":"div.woocommerce-product-details__short-description","ret":"text","as":"single","x":530,"y":420,"wires":[["5d6ab7a1674c8581"]]},{"id":"5d6ab7a1674c8581","type":"debug","z":"c151e39cb3680769","name":"debug 32","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":420,"wires":[]},{"id":"aa458c47c5b6ca5a","type":"inject","z":"c151e39cb3680769","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":540,"wires":[["12448c9f0cc9fcb5"]]},{"id":"12448c9f0cc9fcb5","type":"http request","z":"c151e39cb3680769","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://shop4makers.com/categorie-produit/capteurs/","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":250,"y":540,"wires":[["f52fb90282407e72"]]},{"id":"5d5ccbe86cb246b6","type":"debug","z":"c151e39cb3680769","name":"debug 33","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":800,"y":540,"wires":[]},{"id":"f52fb90282407e72","type":"html","z":"c151e39cb3680769","name":"productLinks","property":"payload","outproperty":"payload","tag":"nav.woocommerce-pagination li","ret":"text","as":"single","x":430,"y":540,"wires":[["1ed16c98242f5377"]]},{"id":"1ed16c98242f5377","type":"function","z":"c151e39cb3680769","name":"convertToNumber","func":"var pages = msg.payload;\nvar lastPage = pages[ pages.length -2 ];\n\n\nmsg.payload = Number(lastPage);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":540,"wires":[["5d5ccbe86cb246b6"]]},{"id":"0e9b22f08160df1d","type":"comment","z":"c151e39cb3680769","name":"get last page","info":"Get last page","x":110,"y":480,"wires":[]},{"id":"f004f34fec70473b","type":"comment","z":"c151e39cb3680769","name":"get data from 1 single product","info":"Get the data from 1 single product","x":380,"y":160,"wires":[]},{"id":"eb218565d5cb5836","type":"inject","z":"c151e39cb3680769","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":720,"wires":[["8941fbed1e8ccd96"]]},{"id":"8941fbed1e8ccd96","type":"http request","z":"c151e39cb3680769","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://shop4makers.com/categorie-produit/capteurs/","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":250,"y":720,"wires":[["cc098ff19ddfeede"]]},{"id":"3a0555d9d6fa336c","type":"debug","z":"c151e39cb3680769","name":"debug 34","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":720,"wires":[]},{"id":"cc098ff19ddfeede","type":"html","z":"c151e39cb3680769","name":"productLinks","property":"payload","outproperty":"payload","tag":"div.product-loop-body.product-item__body","ret":"html","as":"single","x":470,"y":720,"wires":[["3a0555d9d6fa336c"]]},{"id":"1066fb87ca373d75","type":"comment","z":"c151e39cb3680769","name":"get Links of all products","info":"get links of products","x":140,"y":660,"wires":[]}]

Thank you .

Try div.product-loop-body.product-item__body > a
and set the output to an object of any attributes of the elements

1 Like

Thank you , works exactly as expected .

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.