2021年9月4日 星期六

爬取匯率價格

 爬取匯率價格





[{"id":"dd75c89f.246658","type":"inject","z":"8928cd8f.0acc3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":120,"y":80,"wires":[["b984576b.3db788"]]},{"id":"b984576b.3db788","type":"http request","z":"8928cd8f.0acc3","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://rate.bot.com.tw/xrt?Lang=zh-TW","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":80,"wires":[["a586a73d.e7e968","e54b58d8.edfd48"]]},{"id":"a586a73d.e7e968","type":"html","z":"8928cd8f.0acc3","name":"Select_Filter","property":"payload","outproperty":"","tag":".rate-content-cash.text-right.print_hide","ret":"html","as":"single","x":430,"y":80,"wires":[["11887a44.352846"]]},{"id":"990be0ca.6ac98","type":"mqtt in","z":"8928cd8f.0acc3","name":"Jp Rate","topic":"alex9ufo/Jprate","qos":"2","datatype":"auto","broker":"e4d9b72d.d14398","x":90,"y":540,"wires":[["af2c3d09.0421c"]]},{"id":"af2c3d09.0421c","type":"debug","z":"8928cd8f.0acc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":270,"y":540,"wires":[]},{"id":"1d4ce786.7df658","type":"debug","z":"8928cd8f.0acc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":730,"y":180,"wires":[]},{"id":"e54b58d8.edfd48","type":"html","z":"8928cd8f.0acc3","name":"Select_Filter_名稱","property":"payload","outproperty":"","tag":".hidden-phone.print_show","ret":"text","as":"single","x":270,"y":240,"wires":[["138c4104.f61c8f","658079c5.179848"]]},{"id":"138c4104.f61c8f","type":"debug","z":"8928cd8f.0acc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":240,"wires":[]},{"id":"658079c5.179848","type":"function","z":"8928cd8f.0acc3","name":"","func":"var a = msg.payload;\nlet arr = [];\nlet obj;\nvar b;\nvar c;\n\na.forEach(function(e,i){\n    obj = {};\n    //obj.name = a[i];\n    a[i] = a[i].replace(/ /g,\"\");\n    a[i] = a[i].replace(/\\r\\n/g,\"\");\n\n    obj.name = a[i];\n    arr.push(obj) ;    \n})\n\nmsg.payload = arr;\ncontext.global.ExchangerateName= msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":300,"wires":[["1f56e280.8cbd2e"]]},{"id":"1f56e280.8cbd2e","type":"debug","z":"8928cd8f.0acc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":300,"wires":[]},{"id":"11887a44.352846","type":"function","z":"8928cd8f.0acc3","name":"","func":"context.global.Exchangerate= msg.payload;\ncontext.global.lengtTMP=0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":590,"y":180,"wires":[["1d4ce786.7df658","3139a029.3556c","9c1d6c3b.92543"]]},{"id":"4b290e50.5fb82","type":"ui_dropdown","z":"8928cd8f.0acc3","name":"","label":"請選幣別","tooltip":"","place":"Select option","group":"68a79aa3.bcb534","order":2,"width":"4","height":"1","passthru":true,"multiple":false,"options":[{"label":"美金 (USD)","value":"0","type":"str"},{"label":"港幣 (HKD)","value":"1","type":"str"},{"label":"英鎊 (GBP)","value":"2","type":"str"},{"label":"澳幣 (AUD)","value":"3","type":"str"},{"label":"加拿大幣 (CAD)","value":"4","type":"str"},{"label":"新加坡幣 (SGD)","value":"5","type":"str"},{"label":"瑞士法郎 (CHF)","value":"6","type":"str"},{"label":"日圓 (JPY)","value":"7","type":"str"},{"label":"南非幣 (ZAR)","value":"8","type":"str"},{"label":"瑞典幣 (SEK)","value":"9","type":"str"},{"label":"紐元 (NZD)","value":"10","type":"str"},{"label":"泰幣 (THB)","value":"11","type":"str"},{"label":"菲國比索 (PHP)","value":"12","type":"str"},{"label":"印尼幣 (IDR)","value":"13","type":"str"},{"label":"歐元 (EUR)","value":"14","type":"str"},{"label":"韓元 (KRW)","value":"15","type":"str"},{"label":"越南盾 (VND)","value":"16","type":"str"},{"label":"馬來幣 (MYR)","value":"17","type":"str"},{"label":"人民幣 (CNY)","value":"18","type":"str"}],"payload":"","topic":"","x":120,"y":400,"wires":[["e3566bf1.e769c8","3d262b5c.c50944"]]},{"id":"6b6e67da.55aa08","type":"debug","z":"8928cd8f.0acc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":410,"y":400,"wires":[]},{"id":"70cce0e6.5c549","type":"ui_text","z":"8928cd8f.0acc3","group":"68a79aa3.bcb534","order":3,"width":0,"height":0,"name":"","label":"幣  別----->","format":"<font color= {{msg.color}} > {{msg.msg1}} </font>","layout":"row-left","x":840,"y":240,"wires":[]},{"id":"171ce250.b4fb9e","type":"ui_text","z":"8928cd8f.0acc3","group":"68a79aa3.bcb534","order":3,"width":0,"height":0,"name":"","label":"本行現金買入 : ","format":"<font color= {{msg.color}} > {{msg.msg2}} </font>","layout":"row-left","x":860,"y":280,"wires":[]},{"id":"f5dbe412.83b288","type":"ui_text","z":"8928cd8f.0acc3","group":"68a79aa3.bcb534","order":3,"width":0,"height":0,"name":"","label":"本行現金賣出 : ","format":"<font color= {{msg.color}} > {{msg.msg3}} </font>","layout":"row-left","x":860,"y":320,"wires":[]},{"id":"3139a029.3556c","type":"function","z":"8928cd8f.0acc3","name":"","func":"var i= context.global.ExchangeSel;\nvar n= context.global.ExchangerateName;\nvar x= context.global.Exchangerate;\nvar y=Number(i)*2;\n\nmsg.msg1=n[i];\nmsg.msg2=x[y];\nmsg.msg3=x[y+1];\nmsg.color = \"red\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":240,"wires":[["171ce250.b4fb9e","f5dbe412.83b288","70cce0e6.5c549","438ef56f.eae7dc"]]},{"id":"e3566bf1.e769c8","type":"function","z":"8928cd8f.0acc3","name":"","func":"context.global.ExchangeSel=msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":400,"wires":[["6b6e67da.55aa08"]]},{"id":"3d262b5c.c50944","type":"ui_switch","z":"8928cd8f.0acc3","name":"","label":"switch","tooltip":"","group":"68a79aa3.bcb534","order":6,"width":"1","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":140,"y":140,"wires":[["b984576b.3db788"]]},{"id":"9c1d6c3b.92543","type":"function","z":"8928cd8f.0acc3","name":"","func":"\nvar n= context.global.ExchangerateName;\nvar x= context.global.Exchangerate;\n\nvar i= context.global.lengtTMP;\nvar y= Number(i)*2;\n\n    msg.msg1=n[i];\n    msg.msg2=x[y];\n    msg.msg3=x[y+1];\n\ni=i+1;\ncontext.global.lengtTMP=i;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":500,"wires":[["1acfd948.5aa577","1e4fdd79.01a803","5f4022b8.21096c"]]},{"id":"40e61604.165e58","type":"function","z":"8928cd8f.0acc3","name":"","func":"\nvar len=context.global.ExchangerateName.length;\nvar x =context.global.lengtTMP;\n\nif (len==x)\n{\n    context.global.lengtTMP=0;\n\n}\nmsg.cnt=context.global.lengtTMP;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":700,"wires":[["9c1d6c3b.92543","5e8d5abb.13fe94"]]},{"id":"5948590c.0d5258","type":"delay","z":"8928cd8f.0acc3","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":600,"y":700,"wires":[["40e61604.165e58"]]},{"id":"1acfd948.5aa577","type":"function","z":"8928cd8f.0acc3","name":"msg1","func":"msg.payload =  msg.msg1 ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":500,"wires":[["85094f1b.b647d"]]},{"id":"1e4fdd79.01a803","type":"function","z":"8928cd8f.0acc3","name":"msg2","func":"msg.payload =  msg.msg2;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":540,"wires":[["9227674a.af7358"]]},{"id":"5f4022b8.21096c","type":"function","z":"8928cd8f.0acc3","name":"msg3","func":"msg.payload =   msg.msg3;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":580,"wires":[["5948590c.0d5258","88433ea7.c0122"]]},{"id":"85094f1b.b647d","type":"ui_text","z":"8928cd8f.0acc3","group":"68a79aa3.bcb534","order":5,"width":0,"height":0,"name":"","label":"幣  別----->","format":"{{msg.payload}}","layout":"row-left","x":1000,"y":500,"wires":[]},{"id":"9227674a.af7358","type":"ui_text","z":"8928cd8f.0acc3","group":"68a79aa3.bcb534","order":5,"width":"3","height":"1","name":"","label":"本行現金買入 : ","format":"{{msg.payload}}","layout":"row-left","x":1020,"y":540,"wires":[]},{"id":"88433ea7.c0122","type":"ui_text","z":"8928cd8f.0acc3","group":"68a79aa3.bcb534","order":5,"width":"3","height":"1","name":"","label":" 本行現金賣出 : ","format":"{{msg.payload}}","layout":"row-left","x":1020,"y":580,"wires":[]},{"id":"5e8d5abb.13fe94","type":"debug","z":"8928cd8f.0acc3","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"cnt","targetType":"msg","statusVal":"","statusType":"auto","x":940,"y":700,"wires":[]},{"id":"438ef56f.eae7dc","type":"function","z":"8928cd8f.0acc3","name":"選擇幣別的資料","func":"var myJSON = msg.msg1;\nvar str = JSON.stringify(myJSON);\n\nmsg.payload=str+ '  , 現金買入 : ' + msg.msg2+ ' , 現金賣出: ' + msg.msg3;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":380,"wires":[["f723b7d8.a386a8","9cb76a00.ce7d78"]]},{"id":"f723b7d8.a386a8","type":"mqtt out","z":"8928cd8f.0acc3","name":"JP Rate","topic":"alex9ufo/Jprate","qos":"0","retain":"true","broker":"e4d9b72d.d14398","x":940,"y":380,"wires":[]},{"id":"9cb76a00.ce7d78","type":"debug","z":"8928cd8f.0acc3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":980,"y":440,"wires":[]},{"id":"e4d9b72d.d14398","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"68a79aa3.bcb534","type":"ui_group","name":"alexJp_Rate","tab":"a0a49c3.906956","order":1,"disp":true,"width":"6","collapse":false},{"id":"a0a49c3.906956","type":"ui_tab","name":"alex9ufo JP Rate","icon":"dashboard"}]

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...