2021年9月5日 星期日

爬取Yahoo奇摩電影的本周新片

 爬取Yahoo奇摩電影的本周新片




[{"id":"c1c15f09.b3f84","type":"inject","z":"cbbd39b0.9d3068","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"14400","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["a7064284.a180c"]]},{"id":"a7064284.a180c","type":"http request","z":"cbbd39b0.9d3068","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://movies.yahoo.com.tw/movie_thisweek.html","tls":"","persist":false,"proxy":"","authType":"","x":320,"y":120,"wires":[["6ac60818.9787a8"]]},{"id":"6ac60818.9787a8","type":"html","z":"cbbd39b0.9d3068","name":"Select_Filter","property":"payload","outproperty":"","tag":".div, .release_info_text","ret":"text","as":"single","x":480,"y":120,"wires":[["ed41187.19a7ae8","d5e3889.b181978"]]},{"id":"ed41187.19a7ae8","type":"debug","z":"cbbd39b0.9d3068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":120,"wires":[]},{"id":"d5e3889.b181978","type":"function","z":"cbbd39b0.9d3068","name":"","func":"var a = msg.payload;\nlet arr = [];\nlet obj;\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//    a[i] = a[i].replace(/\\n/g,\"\");    \n    a[i] = a[i].split(\"\\n\");\n    obj.name = a[i];\n    arr.push(obj) ;    \n})\n\nmsg.payload = arr;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":530,"y":220,"wires":[["53e74f8f.e1002","413201ab.7eaa"]]},{"id":"53e74f8f.e1002","type":"debug","z":"cbbd39b0.9d3068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":220,"wires":[]},{"id":"f0ee80e3.76e9e","type":"ui_text","z":"cbbd39b0.9d3068","group":"ac0f1141.eb50e","order":78,"width":"0","height":"0","name":"","label":"<font size=4>","format":"<font size=4> {{msg.msg0}}   {{msg.msg1}}","layout":"row-left","x":820,"y":420,"wires":[]},{"id":"413201ab.7eaa","type":"function","z":"cbbd39b0.9d3068","name":"","func":"var a = msg.payload;\nlet arr = [];\nlet obj;\n\na.forEach(function(e,i){\n    obj = {};\n    obj.Cname = a[i].name[3];\n    obj.Ename = a[i].name[6];\n\n    arr.push(obj) ;    \n})\n\nmsg.payload = arr;\ncontext.global.MovieName= msg.payload;\ncontext.global.lengtTMP=0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610,"y":280,"wires":[["ce274347.a013e","f3d649dd.850b48"]]},{"id":"ce274347.a013e","type":"debug","z":"cbbd39b0.9d3068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":280,"wires":[]},{"id":"f3d649dd.850b48","type":"function","z":"cbbd39b0.9d3068","name":"","func":"var n= context.global.MovieName;\nvar i= context.global.lengtTMP;\nvar j=i+1\n    msg.msg0='本週新片 第'+j+'名';\n    msg.msg1=n[i].Cname;\n    msg.msg2=n[i].Ename;\n\ni=i+1;\ncontext.global.lengtTMP=i;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610,"y":420,"wires":[["f0ee80e3.76e9e","e7cee6e5.ec5ba8","167391fb.36c50e"]]},{"id":"66f2f0fe.2d2fb","type":"function","z":"cbbd39b0.9d3068","name":"","func":"\nvar len=context.global.MovieName.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":670,"y":560,"wires":[["f3d649dd.850b48"]]},{"id":"e7cee6e5.ec5ba8","type":"delay","z":"cbbd39b0.9d3068","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":520,"y":560,"wires":[["66f2f0fe.2d2fb"]]},{"id":"167391fb.36c50e","type":"ui_text","z":"cbbd39b0.9d3068","group":"ac0f1141.eb50e","order":78,"width":"0","height":"0","name":"","label":"<font size=4>英文片名  :  ","format":"<font size=4> {{msg.msg2}}","layout":"row-left","x":850,"y":460,"wires":[]},{"id":"ac0f1141.eb50e","type":"ui_group","name":"Movie","tab":"e5eb7b9a.1a6ca8","order":1,"disp":true,"width":"8","collapse":true},{"id":"e5eb7b9a.1a6ca8","type":"ui_tab","name":"電影","icon":"dashboard","disabled":false,"hidden":false}]

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

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