getProfiles()
Get a list of all available browser profile labels.Signature
Returns
Array of profile names that can be used with thebrowser option.
Example
Using a random profile
Picking fromgetProfiles() directly mixes years-old versions with current ones and
leaves the OS to chance, which produces fingerprints no real browser sends. Use
randomProfile() instead.
getOperatingSystems()
Get a list of all available operating systems for emulation.Signature
Returns
Array of OS names that can be used with theos option.
Example
Combining browser and OS
resolveProfile()
Resolve a browser family alias to the concrete profile it points at.Signature
Returns
The concrete profile. Concrete profiles pass through unchanged, so this is safe to call on any value accepted by thebrowser option.
Example
randomProfile()
Pick a random browser profile together with an operating system that browser actually ships on.Signature
Returns
A{ browser, os } pair to spread into createSession(), createTransport() or fetch()
options.
A family is chosen first, then one of its newest latest profiles, then one of the
operating systems it runs on, each uniformly at random. Picks are not weighted by market
share. Each family is only paired with platforms it really ships on:
Chrome, Edge and Firefox are never paired with iOS: on iOS they use WebKit’s network
stack, so their own TLS fingerprint with an iOS User-Agent is a combination no real
browser produces.
Example
RequestError for an unknown family or OS, a latest that is not a positive
integer, or options that leave no family with an allowed OS (such as safari with only
windows).
getEmulationHeaders()
Get the headers a browser profile injects into every request, without sending one.Signature
fetch.
Returns
AHeaders instance holding the profile’s headers, in the profile’s own order and casing.
Transport-level headers are not included: Host, Connection, Content-Length, and
Accept-Encoding are added per request rather than by the emulation profile.
Example
Reusing a profile’s User-Agent
Passing a header throughheaders replaces the profile’s matching header and leaves the
rest of the fingerprint intact, so read the value first when you want to build on it.
Headers
TheHeaders class for working with HTTP headers.
Constructor
Methods
append(name, value): add a header valuedelete(name): remove a headerget(name): get a header valuehas(name): check if header existsset(name, value): set a header valueentries(): iterate over header entrieskeys(): iterate over header namesvalues(): iterate over header values
Example
Response
TheResponse class representing HTTP responses.
Properties
status: HTTP status codestatusText: HTTP status textheaders: response headersok:trueif status is 200-299url: final URL after redirectsredirected:trueif the response is the result of a redirectbody:ReadableStream<Uint8Array>ornullbodyUsed:trueif body has been readcontentLength: content length from headers, ornullcookies: parsed response cookies asRecord<string, string | string[]>
Methods
json(): parse body as JSONtext(): get body as stringtextStream(): get body as aReadableStream<string>of UTF-8 decoded chunksarrayBuffer(): get body as ArrayBufferbytes(): get body as Uint8Arrayblob(): get body as BlobformData(): parse body as FormDataclone(): clone the response