Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //..
- // Configure the proxy router plugin
- const proxyRouter = ProxyRouter({
- proxies: {
- DEFAULT: 'http://217.11.184.20:3128',
- PROXY2: 'http://20.33.5.27:8888',
- PROXY3: 'http://45.133.72.252:3128',
- // Define more proxies as needed
- },
- });
- //..
- // Loop through each proxy
- for (const proxyName of proxyNames) {
- const page = await browser.newPage();
- // Use the current proxy for the page
- await page.route(url, (route) => {
- route.continue({ server: proxyName });
- });
- // Navigate to the target page
- await page.goto(url, { waitUntil: 'domcontentloaded' });
- // Get the text content of the page
- const textContent = await page.evaluate(() => document.body.textContent);
- console.log(textContent);
- // Close the page for the next iteration
- await page.close();
- }
- await browser.close();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement