Set Canvas from API

  • Created

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 Canvas 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 Canvas method in the Local API Clients. Below you can find the examples for Javascript and Python:

Examples

  • @type {import('@kameleo/local-api-client').CreateProfileRequest} */
    const createProfileRequest = {
      fingerprintId: fingerprints[0].id,
      canvas: 'intelligent' // Options: 'intelligent', 'noise', 'block', 'off'
    };
    
    const profile = await client.profile.createProfile(createProfileRequest);
  • from kameleo.local_api_client.models import CreateProfileRequest
    from kameleo.local_api_client.models.canvas_spoofing_type import CanvasSpoofingType
    
    # Create the profile with Canvas spoofing type
    create_profile_request = CreateProfileRequest(
        fingerprint_id=fingerprints[0].id,
        canvas=CanvasSpoofingType.INTELLIGENT  # Options: ('intelligent', 'noise', 'block', 'off')
    )
    
    profile = client.profile.create_profile(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.

Was this article helpful?

0 out of 0 found this helpful