看板 Diary 關於我們 聯絡資訊
practical puppeteer : using proxy to browse a page today puppeteer topic will be related to proxy. using proxy when browse a page is useful when we want to hide our origin access location. that's only one reason. another reason it can be used to protect our privacy and otheuse case is to open a website with geographical restriction. according to wikipedia, in computer networks, a proxy server is a server (a computer system or an application) that acts as an intermediary for requests from clients seeking resources from other servers. a client connects to the proxy server , requesting some service , such as a file , connection , web page ,or other resource available from a different server and the proxy server evaluates the request as a way to simplify and control its complexity. proxies were invented to add structure and encapsulation to distributed systems. in puppetter we can use a proxy when we browse a page on internet. I will use serveral sample of proxy , such as sock4 , sock5 , and HTTP proxy. let's start preparation install puppeteer we also need some proxy sample. for this i will use list of free proxy from and we can pick serveral proxy from there. the code we will use sock4 proxy and IP location of this proxy at cambodia proxy ip address 96.9.77.192 and port 55796. I hope the proxy address still working when you try the example file proxy_with_puppeteer.js run with it it will open website and it will show like below ow nice , it means the proxy works. how about sock5 proxy? it's easy , just change the code that set the proxy like below. for http or https proxy we can do like below. if the proxy need authentication , we can add this code to support authentication . put it before page.goto() part. that's it. thank you and I hope you enjoy it. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.166.114.175 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Diary/M.1576413632.A.7EC.html