ScreamZ / anti-captcha

A modern JS/TS wrapper around anti-captcha API (Captcha Breaker Software)
21 stars 13 forks source link

Missing argument in createTask method #26

Open AnthonyLzq opened 2 years ago

AnthonyLzq commented 2 years ago

I was checking the AntiCaptcha class, the method createTask has three params in the method signature, according to this:

/**
   * Dispatch a task creation to the service. This will return a taskId.
   *
   * @param {string} task - Task to perform
   * @param {string} websiteKey - The value of the "data-site-key" attribute. <- this param is missing
   * @param {string} languagePool - The language pool. Default to English if not provided.
   *
   * @memberof AntiCaptcha
   */
  public async createTask<T>(
    task: T,
    languagePool: LanguagePoolTypes = LanguagePoolTypes.ENGLISH
  ) {
    const response = (await this.api.post("createTask", {
      languagePool,
      task
    })) as ApiResponse<ICreateTaskResponse>;

    if (response.ok && response.data.errorId === 0) {
      return response.data.taskId;
    }
    throw new AntiCaptchaError(
      response.data.errorCode,
      response.data.errorDescription
    );
  }

Is the websiteKey not longer required?

ScreamZ commented 2 years ago

I guess it is, based on the two other things, might be nice to check if you use this endpoint.

Based on that, I guess it is : https://anti-captcha.com/apidoc/methods/createTask

AnthonyLzq commented 2 years ago

I do, in fact createTaskRecaptchaV2Proxyless, createTaskRecaptchaV3Proxyless and createTask both uses the same endpoint, but only in the createTask method the declaration is wrong.