Puppeteer
BrowserCloud supports puppeteer. The latter can be successfully used provided that the appropriate app or service are updated. To use the BrowserCloud service just change the below-mentioned:
- Javascript
- Python
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://chrome-v2.browsercloud.io?token=MY-TOKEN`,
});
const page = await browser.newPage();
// Remember to catch errors and close!
})();
import asyncio
from pyppeteer import connect_over_cdp
async def main():
# Connecting to Chrome locally
browser = await launch()
# Connecting to BrowserCloud
browser = await connect_over_cdp(
endpoint=f"wss://chrome-v2.browsercloud.io?token={TOKEN}"
)
Proxies & GEO targeting
Our residential proxy pool includes over 100 million IPs from 195 countries from over dozens of ISPs and should be sufficient for the vast majority of scraping jobs. A majority of proxy network is composed of Tier A+ model proxies.
BrowserCloud optimizes proxy usage by disabling the download of resources such as images, videos, CSS, fonts, etc. This behavior can be adjusted with a parameter (see more).
Proxy behavior is set by parameters proxy
and proxyCountry
curl --location 'https://chrome-v2.browsercloud.io/content?token=API_TOKEN&proxy=datacenter&proxyCountry=GB&url=https://api.myip.com'
BrowserCloud uses rotating proxies by default, which means every new request inside Chrome might have a new IP.
If you need to keep the same proxy IP during a session please add &proxySticky
parameter to the connection URL
Parameter | Available values | Description |
---|---|---|
proxy | 1) datacenter - datacenter proxy pool with 70mln of fast proxies 2) residential - premium proxy pool for a few particularly difficult to scrape sites 3) omit parameter to use direct connection from our servers | Proxy pool type |
proxyCountry | parameter works with proxy parameter1) two-letter country ISO code. Example: US , CA , GB , DE and more2) omit parameter or set ALL for global rotating | Proxy geo targeting |
proxySticky | add this parameter to use the same IP of the proxy for all requests during one session |
browser = await puppeteer.connect({browserWSEndpoint:
'wss://chrome-v2.browsercloud.io?'+
'token=API_TOKEN'+
'&proxy=residential'+ //proxy type (optional): residential / datacenter
'&proxyCountry=US' //proxy country (optional)
});