puppeteer 阿布云代理设置

Python
const puppeteer = require("puppeteer"); // 代理服务器 const proxyHost = "http-pro.abuyun.com"; const proxyPort = 9010; const proxyServer = "http://" + proxyHost + ":" + proxyPort; // 隧道验证信息 const proxyUser = "H01234567890123P"; const proxyPass = "0123456789012345"; (async () => { const browser = await puppeteer.launch({ ignoreHTTPSErrors: true, headless: false, args: ["--proxy-server=" + proxyServer] }); const page = await browser.newPage(); await page.authenticate({ username : proxyUser, password : proxyPass}); try { await page.goto("https://test.abuyun.com", {timeout: 3000}); } catch(err) { console.log(err); } })();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const puppeteer = require ( "puppeteer" ) ;
 
     / / 代理服务器
     const proxyHost = "http-pro.abuyun.com" ;
     const proxyPort = 9010 ;
     const proxyServer = "http://" + proxyHost + ":" + proxyPort ;
 
     / / 隧道验证信息
     const proxyUser = "H01234567890123P" ;
     const proxyPass = "0123456789012345" ;
 
     ( async ( ) = > {
         const browser = await puppeteer . launch ( {
             ignoreHTTPSErrors : true ,
             headless : false ,
             args : [ "--proxy-server=" + proxyServer ]
         } ) ;
 
         const page = await browser . newPage ( ) ;
 
         await page . authenticate ( { username : proxyUser , password : proxyPass } ) ;
 
         try {
             await page . goto ( "https://test.abuyun.com" , { timeout : 3000 } ) ;
         }
         catch ( err ) {
             console . log ( err ) ;
         }
     } ) ( ) ;
 



你可能感兴趣的:(puppeteer 阿布云代理设置)