How to emulate that click ??
I don't know to emulate the click in node-red.
Look at:
node-red-contrib-nbrowser
I found a nice trick in the browser to get the correct post data, proof of concept, not sure if this will always work, I think the content length may become a problem.
It can be done in node-red, for the enjoyment of @unixneo - the following flow uses curl within node-red and parses the data:
[{"id":"a69c89c5.69982","type":"file in","z":"5dc05a86.d84bcc","name":"file","filename":"/home/administrator/ean.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":218,"y":456,"wires":[["94a4e6fa.45fc"]]},{"id":"fecded6a.78f2c8","type":"delay","z":"5dc05a86.d84bcc","name":"1/3s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":386,"y":456,"wires":[["1f12a9e9.17342e"]]},{"id":"3054f1e8.0c659e","type":"debug","z":"5dc05a86.d84bcc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":938,"y":456,"wires":[]},{"id":"1f12a9e9.17342e","type":"exec","z":"5dc05a86.d84bcc","command":"curl ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":471,"y":456,"wires":[["7d4c27a7.79de58"],[],[]],"l":false},{"id":"94a4e6fa.45fc","type":"function","z":"5dc05a86.d84bcc","name":"","func":"product = parseInt(msg.payload)\nparam = \"'https://www.radiopopular.pt/ajax' -XPOST -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-us' -H 'Accept-Encoding: gzip, deflate, br' -H 'Host: www.radiopopular.pt' -H 'Origin: https://www.radiopopular.pt' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15' -H 'Connection: keep-alive' -H 'Referer: https://www.radiopopular.pt/pesquisa/\"+product+\"' -H 'Content-Length: 102' -H 'Cookie: wpn_https={last_shown:\\\"Sat,07 Mar 2020 16:11:49 GMT\\\",\\\"shown_count\\\":3}; sw_var=A; sw_var_ver=1; rp_cookies_disclamer=1' -H 'X-Requested-With: XMLHttpRequest' --data 'method=getProducts&page=pesquisa&limit=16&offset=0&where=\"+product+\"&filters=&order=preco+ASC&brand=' --compressed\"\nreturn {payload:param}","outputs":1,"noerr":0,"x":303,"y":456,"wires":[["fecded6a.78f2c8"]],"l":false},{"id":"7d4c27a7.79de58","type":"json","z":"5dc05a86.d84bcc","name":"","property":"payload","action":"","pretty":false,"x":519,"y":432,"wires":[["1b9e4639.46e432","2a68d2c0.07182e"]],"l":false},{"id":"1b9e4639.46e432","type":"html","z":"5dc05a86.d84bcc","name":"","property":"payload.modules","outproperty":"payload","tag":".price","ret":"text","as":"single","x":626,"y":432,"wires":[["b1f40c67.88aa1"]]},{"id":"2a68d2c0.07182e","type":"html","z":"5dc05a86.d84bcc","name":"","property":"payload.modules","outproperty":"payload","tag":".designation","ret":"text","as":"single","x":646,"y":480,"wires":[["b1f40c67.88aa1"]]},{"id":"b1f40c67.88aa1","type":"batch","z":"5dc05a86.d84bcc","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":783,"y":456,"wires":[["4beed6df.38928"]],"l":false},{"id":"4beed6df.38928","type":"join","z":"5dc05a86.d84bcc","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":831,"y":456,"wires":[["3054f1e8.0c659e"]],"l":false},{"id":"c5cf143a.94e328","type":"inject","z":"5dc05a86.d84bcc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":456,"wires":[["a69c89c5.69982"]],"l":false}]
Change the file node to your own file with the ean numbers.
Make sure to limit it to 2 or 3 products for initial testing. I have also added a rate limit for the requests, else they might notice too much traffic and may block you.
Gonna try at home. @bakman2 fu**ing amazing that was incredible...
@bakman2 you found the solution ... Thanks homie
@bakman2 how can i make this all come in one msg.payload ? Is there a way to make a single msg.payload with all the information ? Since the code does msg per line if i send the msg.payload trough email it will send for each line
maybe a join node - set to manual - with a timeout ? (assuming you won't ever know exact number of parts)
Hy @dceejay
I tried using node-red-contrib-actionflows but it doesnt work... Also have tried a join node but it gives empty arrays
[{"id":"6842ea38.4467a4","type":"file in","z":"6f52ec7f.86f764","name":"Ficheiro","filename":"/home/nodered/ficheiro.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":200,"y":420,"wires":[["a89960dc.ba8f3"]]},{"id":"fc6ad95d.d83e28","type":"exec","z":"6f52ec7f.86f764","command":"curl ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":175,"y":520,"wires":[["9c330b91.e4fd78"],[],[]],"l":false},{"id":"a89960dc.ba8f3","type":"function","z":"6f52ec7f.86f764","name":"","func":"product = parseInt(msg.payload);\npayload2=msg.payload.toString();\nparam = \"'https://www.radiopopular.pt/ajax' -XPOST -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-us' -H 'Accept-Encoding: gzip, deflate, br' -H 'Host: www.radiopopular.pt' -H 'Origin: https://www.radiopopular.pt' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15' -H 'Connection: keep-alive' -H 'Referer: https://www.radiopopular.pt/pesquisa/\"+product+\"' -H 'Content-Length: 102' -H 'Cookie: wpn_https={last_shown:\\\"Sat,07 Mar 2020 16:11:49 GMT\\\",\\\"shown_count\\\":3}; sw_var=A; sw_var_ver=1; rp_cookies_disclamer=1' -H 'X-Requested-With: XMLHttpRequest' --data 'method=getProducts&page=pesquisa&limit=16&offset=0&where=\"+product+\"&filters=&order=preco+ASC&brand=' --compressed\";\nreturn {payload:param,payload2};","outputs":1,"noerr":0,"x":155,"y":460,"wires":[["3ac24ea4.14bae2"]],"l":false},{"id":"9c330b91.e4fd78","type":"json","z":"6f52ec7f.86f764","name":"","property":"payload","action":"","pretty":false,"x":215,"y":520,"wires":[["edb153b2.4893c","7c21861b.cbabf8"]],"l":false},{"id":"edb153b2.4893c","type":"html","z":"6f52ec7f.86f764","name":"","property":"payload.modules","outproperty":"payload","tag":".price","ret":"text","as":"single","x":322,"y":520,"wires":[["ae73f680.186208"]]},{"id":"7c21861b.cbabf8","type":"html","z":"6f52ec7f.86f764","name":"","property":"payload.modules","outproperty":"payload","tag":".designation","ret":"text","as":"single","x":334,"y":564,"wires":[["ae73f680.186208"]]},{"id":"ae73f680.186208","type":"batch","z":"6f52ec7f.86f764","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":439,"y":544,"wires":[["2522f3ef.bcb21c"]],"l":false},{"id":"2522f3ef.bcb21c","type":"join","z":"6f52ec7f.86f764","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":499,"y":544,"wires":[["e55f911a.7d571"]],"l":false},{"id":"e55f911a.7d571","type":"function","z":"6f52ec7f.86f764","name":"","func":"var Descri = msg.payload[1][0]\nvar Valor = msg.payload[0][0]\nvar mensagem = \n\"\\n DescriĆ§Ć£o: \" + Descri + \n\"\\n Ean: \" + flow.get(\"produto\") + \n\"\\n Valor:\"+ Valor ;\n\nmsg.payload = mensagem;\nreturn msg;","outputs":1,"noerr":0,"x":539,"y":544,"wires":[["13bc2d65.304173"]],"l":false},{"id":"44c21278.68547c","type":"function","z":"6f52ec7f.86f764","name":"","func":"flow.set (\"produto\" , msg.payload2);\nreturn msg ;","outputs":1,"noerr":0,"x":355,"y":460,"wires":[["fc6ad95d.d83e28"]],"l":false},{"id":"13bc2d65.304173","type":"file","z":"6f52ec7f.86f764","name":"","filename":"/home/nodered/temp.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":690,"y":540,"wires":[["71b44fdd.fb202"]]},{"id":"73aa4c80.44ca74","type":"template","z":"6f52ec7f.86f764","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<p>Leitura do Fichiero {{originalname}} completa !</p>\n\n<h2>Conteudo:</h2>\n\n<pre>\n{{{payload}}}\n</pre>","output":"str","x":800,"y":240,"wires":[["675300ee.b591b"]]},{"id":"a917dfe3.88c62","type":"function","z":"6f52ec7f.86f764","name":"Converte para msg.payload","func":"if (msg.req.files[0].mimetype.includes('image')) {\n msg.payload = `<img src=\"data:image/gif;base64,${msg.payload.toString('base64')}\">`;\n} else {\n msg.payload = msg.payload.toString();\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":120,"y":200,"wires":[["e374a4a.2d49658"]]},{"id":"e524aa7f.4d8478","type":"http in","z":"6f52ec7f.86f764","name":"","url":"/conteudo","method":"post","upload":true,"swaggerDoc":"","x":80,"y":140,"wires":[["6114d25a.edeeec"]]},{"id":"6114d25a.edeeec","type":"change","z":"6f52ec7f.86f764","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"req.files[0].buffer","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":140,"wires":[["a917dfe3.88c62"]]},{"id":"e374a4a.2d49658","type":"file","z":"6f52ec7f.86f764","name":"","filename":"/home/nodered/ficheiro.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":140,"y":240,"wires":[["1734ad4.9443a53"]]},{"id":"3ac24ea4.14bae2","type":"delay","z":"6f52ec7f.86f764","name":"1/3s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":460,"wires":[["44c21278.68547c"]]},{"id":"49f9a9e3.f52428","type":"debug","z":"6f52ec7f.86f764","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":320,"wires":[]},{"id":"1c1290db.57929f","type":"actionflows_in","z":"6f52ec7f.86f764","name":"action in","priority":"50","links":[],"scope":"global","x":60,"y":420,"wires":[["6842ea38.4467a4"]]},{"id":"1734ad4.9443a53","type":"bigfile reader","z":"6f52ec7f.86f764","name":"output as lines","filename":"/home/nodered/ficheiro.txt","nopayload":true,"flow":"lines","highWaterMark":"","encoding":"utf8","format":"utf8","keepEmptyLines":false,"x":120,"y":280,"wires":[["151b8f7.8b5a771"],["151b8f7.8b5a771"]]},{"id":"151b8f7.8b5a771","type":"function","z":"6f52ec7f.86f764","name":"line counter","func":"if (msg.payload) {\n global.lines++;\n}\nif (msg.control && msg.control.state == 'start') {\n global.lines = 0;\n}\nif (msg.control && msg.control.state == 'end') {\n node.send({ payload: global.lines })\n}\n","outputs":1,"noerr":0,"x":90,"y":320,"wires":[["be7bd8bb.0724b8"]]},{"id":"be7bd8bb.0724b8","type":"actionflows","z":"6f52ec7f.86f764","info":"Describe your action API here.","untilproptype":"num","proptype":"global","name":"action","prop":"lines","untilprop":0,"until":"eq","loop":"dec","scope":"global","perf":true,"seq":true,"x":70,"y":360,"wires":[["49f9a9e3.f52428"]]},{"id":"71b44fdd.fb202","type":"actionflows_out","z":"6f52ec7f.86f764","name":"action out","links":[],"x":860,"y":480,"wires":[]},{"id":"675300ee.b591b","type":"http response","z":"6f52ec7f.86f764","name":"","statusCode":"","headers":{},"x":930,"y":240,"wires":[]}]
sorry I don't know actionflows so can't import your flow.
Here is a more cleaner version of the flow
[{"id":"5119c6b0.32e878","type":"file in","z":"55167945.a92168","name":"Ficheiro","filename":"/home/nodered/ficheiro.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":180,"y":340,"wires":[["a7d2be22.28b31"]]},{"id":"e62361c4.73951","type":"exec","z":"55167945.a92168","command":"curl ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":115,"y":380,"wires":[["c0ccbb02.b9bba8"],[],[]],"l":false},{"id":"a7d2be22.28b31","type":"function","z":"55167945.a92168","name":"","func":"product = parseInt(msg.payload);\npayload2=msg.payload.toString();\nparam = \"'https://www.radiopopular.pt/ajax' -XPOST -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-us' -H 'Accept-Encoding: gzip, deflate, br' -H 'Host: www.radiopopular.pt' -H 'Origin: https://www.radiopopular.pt' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15' -H 'Connection: keep-alive' -H 'Referer: https://www.radiopopular.pt/pesquisa/\"+product+\"' -H 'Content-Length: 102' -H 'Cookie: wpn_https={last_shown:\\\"Sat,07 Mar 2020 16:11:49 GMT\\\",\\\"shown_count\\\":3}; sw_var=A; sw_var_ver=1; rp_cookies_disclamer=1' -H 'X-Requested-With: XMLHttpRequest' --data 'method=getProducts&page=pesquisa&limit=16&offset=0&where=\"+product+\"&filters=&order=preco+ASC&brand=' --compressed\";\nreturn {payload:param,payload2};","outputs":1,"noerr":0,"x":295,"y":340,"wires":[["acc661f3.e9d52"]],"l":false},{"id":"c0ccbb02.b9bba8","type":"json","z":"55167945.a92168","name":"","property":"payload","action":"","pretty":false,"x":155,"y":380,"wires":[["65348004.f038b","69c77399.146d7c"]],"l":false},{"id":"65348004.f038b","type":"html","z":"55167945.a92168","name":"","property":"payload.modules","outproperty":"payload","tag":".price","ret":"text","as":"single","x":262,"y":380,"wires":[["4f54c887.ff2628"]]},{"id":"69c77399.146d7c","type":"html","z":"55167945.a92168","name":"","property":"payload.modules","outproperty":"payload","tag":".designation","ret":"text","as":"single","x":274,"y":424,"wires":[["4f54c887.ff2628"]]},{"id":"4f54c887.ff2628","type":"batch","z":"55167945.a92168","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":379,"y":404,"wires":[["abb7071a.9da7a8"]],"l":false},{"id":"abb7071a.9da7a8","type":"join","z":"55167945.a92168","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":439,"y":404,"wires":[["a316fe90.476f9"]],"l":false},{"id":"a316fe90.476f9","type":"function","z":"55167945.a92168","name":"","func":"var Descri = msg.payload[1][0]\nvar Valor = msg.payload[0][0]\nvar mensagem = \n\"\\n DescriĆ§Ć£o: \" + Descri + \n\"\\n Ean: \" + flow.get(\"produto\") + \n\"\\n Valor:\"+ Valor ;\n\nmsg.payload = mensagem;\nreturn msg;","outputs":1,"noerr":0,"x":479,"y":404,"wires":[["77d44af4.a9bba4"]],"l":false},{"id":"aed2754d.383ec8","type":"function","z":"55167945.a92168","name":"","func":"flow.set (\"produto\" , msg.payload2);\nreturn msg ;","outputs":1,"noerr":0,"x":495,"y":340,"wires":[["e62361c4.73951"]],"l":false},{"id":"77d44af4.a9bba4","type":"file","z":"55167945.a92168","name":"","filename":"/home/nodered/temp.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":630,"y":400,"wires":[["abb1f6ab.d38db8"]]},{"id":"89da5ca2.2e44a","type":"http response","z":"55167945.a92168","name":"","statusCode":"","headers":{},"x":1030,"y":300,"wires":[]},{"id":"abb1f6ab.d38db8","type":"template","z":"55167945.a92168","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<p>Leitura do Fichiero {{originalname}} completa !</p>\n\n<h2>Conteudo:</h2>\n\n<pre>\n{{{payload}}}\n</pre>","output":"str","x":900,"y":300,"wires":[["89da5ca2.2e44a"]]},{"id":"52fe90e1.d7595","type":"function","z":"55167945.a92168","name":"Converte para msg.payload","func":"if (msg.req.files[0].mimetype.includes('image')) {\n msg.payload = `<img src=\"data:image/gif;base64,${msg.payload.toString('base64')}\">`;\n} else {\n msg.payload = msg.payload.toString();\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":220,"y":260,"wires":[["a2b1d7be.7c2d58"]]},{"id":"b0a44294.260c9","type":"http in","z":"55167945.a92168","name":"","url":"/conteudo","method":"post","upload":true,"swaggerDoc":"","x":180,"y":200,"wires":[["cd1ac45e.b3b388"]]},{"id":"cd1ac45e.b3b388","type":"change","z":"55167945.a92168","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"req.files[0].buffer","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[["52fe90e1.d7595"]]},{"id":"a2b1d7be.7c2d58","type":"file","z":"55167945.a92168","name":"","filename":"/home/nodered/ficheiro.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":240,"y":300,"wires":[["5119c6b0.32e878"]]},{"id":"acc661f3.e9d52","type":"delay","z":"55167945.a92168","name":"1/3s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":410,"y":340,"wires":[["aed2754d.383ec8"]]}]
@LucasSaraivaAzevedo as @dceejay suggested: a join node works (ie, after the last join node). Set it to manual, create an array with a timeout.
@bakman2 and @dceejay when i putt a join node, node-red crashes saying that lost connection with the server, reconnectig...
[{"id":"5119c6b0.32e878","type":"file in","z":"55167945.a92168","name":"Ficheiro","filename":"/home/nodered/ficheiro.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":180,"y":340,"wires":[["a7d2be22.28b31"]]},{"id":"e62361c4.73951","type":"exec","z":"55167945.a92168","command":"curl ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":115,"y":380,"wires":[["c0ccbb02.b9bba8"],[],[]],"l":false},{"id":"a7d2be22.28b31","type":"function","z":"55167945.a92168","name":"","func":"product = parseInt(msg.payload);\npayload2=msg.payload.toString();\nparam = \"'https://www.radiopopular.pt/ajax' -XPOST -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-us' -H 'Accept-Encoding: gzip, deflate, br' -H 'Host: www.radiopopular.pt' -H 'Origin: https://www.radiopopular.pt' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15' -H 'Connection: keep-alive' -H 'Referer: https://www.radiopopular.pt/pesquisa/\"+product+\"' -H 'Content-Length: 102' -H 'Cookie: wpn_https={last_shown:\\\"Sat,07 Mar 2020 16:11:49 GMT\\\",\\\"shown_count\\\":3}; sw_var=A; sw_var_ver=1; rp_cookies_disclamer=1' -H 'X-Requested-With: XMLHttpRequest' --data 'method=getProducts&page=pesquisa&limit=16&offset=0&where=\"+product+\"&filters=&order=preco+ASC&brand=' --compressed\";\nreturn {payload:param,payload2};","outputs":1,"noerr":0,"x":295,"y":340,"wires":[["acc661f3.e9d52"]],"l":false},{"id":"c0ccbb02.b9bba8","type":"json","z":"55167945.a92168","name":"","property":"payload","action":"","pretty":false,"x":155,"y":380,"wires":[["65348004.f038b","69c77399.146d7c"]],"l":false},{"id":"65348004.f038b","type":"html","z":"55167945.a92168","name":"","property":"payload.modules","outproperty":"payload","tag":".price","ret":"text","as":"single","x":262,"y":380,"wires":[["4f54c887.ff2628"]]},{"id":"69c77399.146d7c","type":"html","z":"55167945.a92168","name":"","property":"payload.modules","outproperty":"payload","tag":".designation","ret":"text","as":"single","x":274,"y":424,"wires":[["4f54c887.ff2628"]]},{"id":"4f54c887.ff2628","type":"batch","z":"55167945.a92168","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":379,"y":404,"wires":[["abb7071a.9da7a8"]],"l":false},{"id":"abb7071a.9da7a8","type":"join","z":"55167945.a92168","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":439,"y":404,"wires":[["a316fe90.476f9"]],"l":false},{"id":"a316fe90.476f9","type":"function","z":"55167945.a92168","name":"","func":"var Descri = msg.payload[1][0]\nvar Valor = msg.payload[0][0]\nvar mensagem = \n\"\\n DescriĆ§Ć£o: \" + Descri + \n\"\\n Ean: \" + flow.get(\"produto\") + \n\"\\n Valor:\"+ Valor ;\n\nmsg.payload = mensagem;\nreturn msg;","outputs":1,"noerr":0,"x":479,"y":404,"wires":[["77d44af4.a9bba4"]],"l":false},{"id":"aed2754d.383ec8","type":"function","z":"55167945.a92168","name":"","func":"flow.set (\"produto\" , msg.payload2);\nreturn msg ;","outputs":1,"noerr":0,"x":495,"y":340,"wires":[["e62361c4.73951"]],"l":false},{"id":"77d44af4.a9bba4","type":"file","z":"55167945.a92168","name":"","filename":"/home/nodered/temp.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":630,"y":400,"wires":[["abb1f6ab.d38db8"]]},{"id":"89da5ca2.2e44a","type":"http response","z":"55167945.a92168","name":"","statusCode":"","headers":{},"x":1030,"y":300,"wires":[]},{"id":"abb1f6ab.d38db8","type":"template","z":"55167945.a92168","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<p>Leitura do Fichiero {{originalname}} completa !</p>\n\n<h2>Conteudo:</h2>\n\n<pre>\n{{{payload}}}\n</pre>","output":"str","x":900,"y":300,"wires":[["89da5ca2.2e44a"]]},{"id":"52fe90e1.d7595","type":"function","z":"55167945.a92168","name":"Converte para msg.payload","func":"if (msg.req.files[0].mimetype.includes('image')) {\n msg.payload = `<img src=\"data:image/gif;base64,${msg.payload.toString('base64')}\">`;\n} else {\n msg.payload = msg.payload.toString();\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":220,"y":260,"wires":[["a2b1d7be.7c2d58"]]},{"id":"b0a44294.260c9","type":"http in","z":"55167945.a92168","name":"","url":"/conteudo","method":"post","upload":true,"swaggerDoc":"","x":180,"y":200,"wires":[["cd1ac45e.b3b388"]]},{"id":"cd1ac45e.b3b388","type":"change","z":"55167945.a92168","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"req.files[0].buffer","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[["52fe90e1.d7595"]]},{"id":"a2b1d7be.7c2d58","type":"file","z":"55167945.a92168","name":"","filename":"/home/nodered/ficheiro.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":240,"y":300,"wires":[["5119c6b0.32e878"]]},{"id":"acc661f3.e9d52","type":"delay","z":"55167945.a92168","name":"1/3s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":410,"y":340,"wires":[["aed2754d.383ec8"]]}]
We cannot import your flow as you have data we do not have.
And you post the same flow without the additional join node.
@bakman2 here is the full flow
[{"id":"ce11c637.8734c8","type":"http in","z":"6f52ec7f.86f764","name":"","url":"/upload","method":"get","upload":false,"swaggerDoc":"","x":110,"y":40,"wires":[["8120efb9.235b8"]]},{"id":"8120efb9.235b8","type":"template","z":"6f52ec7f.86f764","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<h1>Upload a file here:</h1>\n\n<form action=\"/conteudo\" method=\"POST\" enctype=\"multipart/form-data\">\n <input type=\"file\" name=\"myFile\" />\n <input type=\"submit\" value=\"Submit\">\n</form>","output":"str","x":290,"y":40,"wires":[["f3c2c379.f3d7d"]]},{"id":"f3c2c379.f3d7d","type":"http response","z":"6f52ec7f.86f764","name":"","x":450,"y":40,"wires":[]},{"id":"f2eae414.0daca8","type":"file in","z":"6f52ec7f.86f764","name":"Ficheiro","filename":"/home/nodered/ficheiro.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":160,"y":280,"wires":[["9b272ffb.11731"]]},{"id":"949bb5d7.667358","type":"exec","z":"6f52ec7f.86f764","command":"curl ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":135,"y":340,"wires":[["d78b87b0.96a938"],[],[]],"l":false},{"id":"9b272ffb.11731","type":"function","z":"6f52ec7f.86f764","name":"","func":"product = parseInt(msg.payload);\npayload2=msg.payload.toString();\nparam = \"'https://www.radiopopular.pt/ajax' -XPOST -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-us' -H 'Accept-Encoding: gzip, deflate, br' -H 'Host: www.radiopopular.pt' -H 'Origin: https://www.radiopopular.pt' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15' -H 'Connection: keep-alive' -H 'Referer: https://www.radiopopular.pt/pesquisa/\"+product+\"' -H 'Content-Length: 102' -H 'Cookie: wpn_https={last_shown:\\\"Sat,07 Mar 2020 16:11:49 GMT\\\",\\\"shown_count\\\":3}; sw_var=A; sw_var_ver=1; rp_cookies_disclamer=1' -H 'X-Requested-With: XMLHttpRequest' --data 'method=getProducts&page=pesquisa&limit=16&offset=0&where=\"+product+\"&filters=&order=preco+ASC&brand=' --compressed\";\nreturn {payload:param,payload2};","outputs":1,"noerr":0,"x":275,"y":280,"wires":[["31ad1f83.33208"]],"l":false},{"id":"d78b87b0.96a938","type":"json","z":"6f52ec7f.86f764","name":"","property":"payload","action":"","pretty":false,"x":175,"y":340,"wires":[["af4da3c8.130e3","706d5411.e62afc"]],"l":false},{"id":"af4da3c8.130e3","type":"html","z":"6f52ec7f.86f764","name":"","property":"payload.modules","outproperty":"payload","tag":".price","ret":"text","as":"single","x":282,"y":340,"wires":[["b6305a9.7bd8da8"]]},{"id":"706d5411.e62afc","type":"html","z":"6f52ec7f.86f764","name":"","property":"payload.modules","outproperty":"payload","tag":".designation","ret":"text","as":"single","x":294,"y":384,"wires":[["b6305a9.7bd8da8"]]},{"id":"b6305a9.7bd8da8","type":"batch","z":"6f52ec7f.86f764","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":399,"y":364,"wires":[["5646925b.3bb62c"]],"l":false},{"id":"5646925b.3bb62c","type":"join","z":"6f52ec7f.86f764","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":459,"y":364,"wires":[["a32f55fc.72a9b8"]],"l":false},{"id":"a32f55fc.72a9b8","type":"function","z":"6f52ec7f.86f764","name":"","func":"var Descri = msg.payload[1][0]\nvar Valor = msg.payload[0][0]\nvar mensagem = \n\"\\n DescriĆ§Ć£o: \" + Descri + \n\"\\n Ean: \" + flow.get(\"produto\") + \n\"\\n Valor:\"+ Valor ;\n\nmsg.payload = mensagem;\nreturn msg;","outputs":1,"noerr":0,"x":499,"y":364,"wires":[["82ca4268.2ebf7"]],"l":false},{"id":"123d8bcf.963054","type":"function","z":"6f52ec7f.86f764","name":"","func":"flow.set (\"produto\" , msg.payload2);\nreturn msg ;","outputs":1,"noerr":0,"x":495,"y":280,"wires":[["949bb5d7.667358"]],"l":false},{"id":"82ca4268.2ebf7","type":"file","z":"6f52ec7f.86f764","name":"","filename":"/home/nodered/temp.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":650,"y":360,"wires":[["82a15f9a.abda3"]]},{"id":"14b44709.72d9a9","type":"function","z":"6f52ec7f.86f764","name":"Converte para msg.payload","func":"if (msg.req.files[0].mimetype.includes('image')) {\n msg.payload = `<img src=\"data:image/gif;base64,${msg.payload.toString('base64')}\">`;\n} else {\n msg.payload = msg.payload.toString();\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":200,"wires":[["7e1b5a05.fbbe94"]]},{"id":"7af9d1d9.94454","type":"http in","z":"6f52ec7f.86f764","name":"","url":"/conteudo","method":"post","upload":true,"swaggerDoc":"","x":160,"y":140,"wires":[["8e845b07.06e6d8"]]},{"id":"8e845b07.06e6d8","type":"change","z":"6f52ec7f.86f764","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"req.files[0].buffer","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":140,"wires":[["14b44709.72d9a9"]]},{"id":"7e1b5a05.fbbe94","type":"file","z":"6f52ec7f.86f764","name":"","filename":"/home/nodered/ficheiro.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":220,"y":240,"wires":[["f2eae414.0daca8"]]},{"id":"31ad1f83.33208","type":"delay","z":"6f52ec7f.86f764","name":"1/3s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":280,"wires":[["123d8bcf.963054"]]},{"id":"82a15f9a.abda3","type":"join","z":"6f52ec7f.86f764","name":"","mode":"custom","build":"buffer","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"15","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":830,"y":340,"wires":[["c05c30f6.3bdfd"]]},{"id":"c05c30f6.3bdfd","type":"debug","z":"6f52ec7f.86f764","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1040,"y":320,"wires":[]}]
We do not have your files that you use as input so we cannot run the flow.
The join node needs to go here.
How can i tip you @bakman2 ??? Thanks for the patience sensei
I would really like to pay a coffee to both of you @dceejay and @bakman2 you guys are really hardcore with nodered
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.