Skip to main content
Version: 3.6

ProxyInfo

The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of crawlers, you can get this object by calling ProxyConfiguration.newProxyInfo.

Example usage:

const proxyConfiguration = new ProxyConfiguration({
proxyUrls: ['...', '...'] // List of Proxy URLs to rotate
});

// Getting proxyInfo object by calling class method directly
const proxyInfo = await proxyConfiguration.newProxyInfo();

// In crawler
const crawler = new CheerioCrawler({
// ...
proxyConfiguration,
requestHandler({ proxyInfo }) {
// Getting used proxy URL
const proxyUrl = proxyInfo.url;

// Getting ID of used Session
const sessionIdentifier = proxyInfo.sessionId;
}
})

Index

Properties

hostname

hostname: string

Hostname of your proxy.

password

password: string

User's password for the proxy.

port

port: string | number

Proxy port.

optionalsessionId

sessionId?: string

The identifier of used Session, if used.

url

url: string

The URL of the proxy.

optionalusername

username?: string

Username for the proxy.