In this article, we'll guide you through setting up Canvas spoofing in Kameleo whilst the Local API Clients. Canvas spoofing allows you to modify Canvas fingerprinting behavior to bypass anti-bot systems during web-scraping or browser automation projects.
To learn more about Canvas and how Kameleo is spoofing it in order to let you bypass anti-bot systems during your web-scraping or browser automation projects please read the following articles:
Concept
During the CreateProfileRequest
POST /profiles/new
You can pass the CreateProfileRequest object that has a CanvasSpoofingType property. This can be used to set up Canvas spoofing. Furthermore, when creating a new profile via the Kameleo Local API, you can specify Canvas spoofing behavior using the setCanvas
method. Possible values for the Canvas spoofing type are:
- Intelligent: Use intelligent canvas spoofing, which generates non-unique canvas fingerprints.
- Noise: Add noise to canvas generation.
- Block: Completely block the 2D API.
- Off: Turn off the spoofing and use the original settings.
To set the Canvas spoofing type, use the setCanvas
method in the Local API Clients. Below you can find the examples for Javascript and Python:
Examples
-
const createProfileRequest = BuilderForCreateProfile .forBaseProfile(baseProfileId) .set_canvas('intelligent') \ # Options: ('intelligent', 'noise', 'block', 'off') .build(); const profile = await client.createProfile({ body: createProfileRequest });
-
create_profile_request = BuilderForCreateProfile \ .for_base_profile(base_profiles[0].id) \ .set_canvas('intelligent') \ # Options: ('intelligent', 'noise', 'block', 'off') .build() profile = client.create_profile(body=create_profile_request)
We suggest you to use the "Intelligent" setting as it's recommended by default.
Use the appropriate Canvas spoofing type according to your needs for web automation or scraping tasks.
For your convenience, this functionality is provided by the Python Builder and JavaScript Builder for Profile Creation in the Local API Clients.