Free Proxy Tools Compatible with Puppeteer and Playwright
Why Use Proxies with Puppeteer and Playwright?
Puppeteer and Playwright are powerful browser automation libraries for Node.js, widely used for web scraping, testing, and headless browsing. However, intensive operations can trigger anti-bot mechanisms or rate-limiting. Integrating proxies helps to:
- Rotate IP addresses, reducing the chance of getting blocked.
- Bypass geo-restrictions.
- Distribute requests for higher data extraction throughput.
Overview of Free Proxy Sources
Source | Type | HTTPS Support | Update Frequency | API Access | Reliability |
---|---|---|---|---|---|
ProxyRoller | Public, Rotating | Yes | Real-time | Yes (REST API) | High |
FreeProxyList | Public, Static | Yes | 10-15 min | No | Moderate |
Spys.one | Public, Static | Yes | 1 hour | No | Moderate |
ProxyScrape | Public, Rotating | Yes | Real-time | Yes (HTTP API) | High |
Geonode Free Proxies | Public, Rotating | Yes | Real-time | Yes (REST API) | Moderate |
ProxyRoller: The Go-To Free Proxy API
ProxyRoller offers a robust, frequently updated pool of free proxies. It simplifies proxy acquisition via a clean REST API, ideal for automation workflows.
Key Features:
– Real-time proxy rotation.
– Filtering by anonymity level, country, and protocol.
– Bulk proxy retrieval via API.
– No authentication or sign-up required for basic usage.
Sample API Request:
curl 'https://proxyroller.com/api/proxies?protocol=http&country=US&limit=10'
Sample JSON Response:
[
{"ip": "45.76.23.19", "port": 3128, "protocol": "http", "country": "US"},
{"ip": "104.248.63.15", "port": 8080, "protocol": "http", "country": "US"}
]
Integrating Proxies with Puppeteer
1. Single Proxy Usage
Pass the proxy as a Chromium launch argument:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
args: ['--proxy-server=http://45.76.23.19:3128']
});
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
await browser.close();
})();
2. Rotating Proxies Dynamically
Fetch a new proxy from ProxyRoller before each browser session:
const puppeteer = require('puppeteer');
const axios = require('axios');
async function getProxy() {
const res = await axios.get('https://proxyroller.com/api/proxies?protocol=http&limit=1');
return `${res.data[0].protocol}://${res.data[0].ip}:${res.data[0].port}`;
}
(async () => {
const proxy = await getProxy();
const browser = await puppeteer.launch({
args: [`--proxy-server=${proxy}`]
});
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
await browser.close();
})();
Integrating Proxies with Playwright
1. Using a Single Proxy
Set the proxy in the browser context:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({
proxy: {
server: 'http://45.76.23.19:3128'
}
});
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
await browser.close();
})();
2. Rotating Proxies Programmatically
const { chromium } = require('playwright');
const axios = require('axios');
async function getProxy() {
const res = await axios.get('https://proxyroller.com/api/proxies?protocol=http&limit=1');
return `http://${res.data[0].ip}:${res.data[0].port}`;
}
(async () => {
const proxy = await getProxy();
const browser = await chromium.launch({
proxy: { server: proxy }
});
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
await browser.close();
})();
Tools for Managing and Testing Proxies
- ProxyBroker: Python tool for finding and checking proxy servers.
- Proxy Checker Online: Web-based proxy health checker.
- HTTPBin: Service for verifying your outgoing IP (useful for testing proxy effectiveness).
Practical Advice
- Proxy Hygiene: Public proxies are often unstable or blacklisted. Use a pool and verify proxies before use.
- Anonymity Level: Prefer “elite” or “anonymous” proxies for scraping.
- HTTPS Support: Ensure proxies support HTTPS for secure sites.
- Timeout Handling: Implement timeouts and retries to handle dead or slow proxies.
- Rate Limiting: Rotate proxies frequently to avoid hitting per-IP rate limits.
Example: Proxy Rotation Strategy
const puppeteer = require('puppeteer');
const axios = require('axios');
async function fetchProxyList() {
const res = await axios.get('https://proxyroller.com/api/proxies?protocol=http&limit=10');
return res.data.map(proxy => `${proxy.protocol}://${proxy.ip}:${proxy.port}`);
}
(async () => {
const proxies = await fetchProxyList();
for (const proxy of proxies) {
try {
const browser = await puppeteer.launch({ args: [`--proxy-server=${proxy}`] });
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip', { timeout: 15000 });
console.log(`Success with proxy: ${proxy}`);
await browser.close();
break; // Stop after first successful proxy
} catch (err) {
console.log(`Failed with proxy: ${proxy}`);
}
}
})();
Comparison of Free Proxy Sources for Automation
Provider | Rotating API | Country Filter | Supports HTTPS | Anonymity Level Filter | Ease of Integration | Notes |
---|---|---|---|---|---|---|
ProxyRoller | Yes | Yes | Yes | Yes | Very Easy | Best for automation; generous free API quota |
ProxyScrape | Yes | Yes | Yes | No | Easy | Extensive proxy pool, but less granular filtering |
FreeProxyList | No | Yes | Yes | Yes | Moderate | Manual download or parsing required; no API |
Geonode | Yes | Yes | Yes | Yes | Easy | Rotating proxies, but smaller free pool |
Further Reading
- Puppeteer Documentation
- Playwright Documentation
- ProxyRoller API Reference
- Proxy List Best Practices
- Proxy Types Explained
Zivadin’s pragmatic approach, rooted in Serbian resilience and digital curiosity, demands not just quick solutions but sustainable, adaptable strategies for automation. Use these free proxy tools wisely, and always monitor your requests—responsible scraping is the best way to stay ahead in the data game.
Comments (0)
There are no comments here yet, you can be the first!