Blog
How to solve FunCaptcha with Go

How to solve FunCaptcha with Go

Logo of Capsolver

CapSolver Blogger

How to use capsolver

28-Sep-2023

Bypassing funcaptcha, funcaptcha with GO, funcaptcha go solver

⚙️ Prerequisites

  • Proxy (Optional)
  • GO installed
  • Capsolver API key

👨‍💻 GO Code for solve FunCaptcha without proxy

Here's a GO sample script to accomplish the task:

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"time"
)

const (
	clientKey = "" // Replace with your actual CAPSOLVER_KEY
)

func main() {
	pageURL := "page"
	siteKey := "site key" // Replace with your proxy

	taskID, err := solveFunCaptcha(pageURL, siteKey,  clientKey)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	if taskID != "" {
		solution, err := getTaskResult(taskID, clientKey)
		if err != nil {
			fmt.Println("Error:", err)
			return
		}


		solutionToken, ok := solution["token"].(string)
		if !ok {
			fmt.Println("No token found in the solution")
			return
		}
		fmt.Println("Solution token:", solutionToken)


	
	}
}


func solveFunCaptcha(pageURL, websitePublicKey, clientKey string) (string, error) {
	payload := map[string]interface{}{
		"clientKey": clientKey,
		"task": map[string]string{
			"type":       "FunCaptchaTaskProxyLess",
			"websiteURL": pageURL,
			"websitePublicKey": websitePublicKey,
		
		},
	}

	data, err := json.Marshal(payload)

	if err != nil {
		return "", err
	}
	fmt.Println("Creating Task")
	resp, err := http.Post("https://api.capsolver.com/createTask", "application/json", bytes.NewBuffer(data))
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()

	if resp.StatusCode != 200 {
		return "", fmt.Errorf("Error creating task: Received HTTP status %d", resp.StatusCode)
	}

	var response map[string]interface{}

	err = json.NewDecoder(resp.Body).Decode(&response)
	if err != nil {
		return "", err
	}

	taskID, ok := response["taskId"].(string)
	fmt.Println("Got Task id  " + taskID)
	if !ok {
		return "", fmt.Errorf("No taskId found in the response")
	}

	return taskID, nil
}

func getTaskResult(taskID, clientKey string) (map[string]interface{}, error) {
	payload := map[string]string{
		"clientKey": clientKey,
		"taskId":    taskID,
	}

	for {
		fmt.Println("Getting Task Result")
		data, err := json.Marshal(payload)
		if err != nil {
			return nil, err
		}

		resp, err := http.Post("https://api.capsolver.com/getTaskResult", "application/json", bytes.NewBuffer(data))
		if err != nil {
			return nil, err
		}
		defer resp.Body.Close()

		if resp.StatusCode != 200 {
			return nil, fmt.Errorf("Error getting task result: Received HTTP status %d", resp.StatusCode)
		}

		var result map[string]interface{}
		err = json.NewDecoder(resp.Body).Decode(&result)
		if err != nil {
			return nil, err
		}

		status, ok := result["status"].(string)
		if !ok {
			return nil, fmt.Errorf("No status found in the response")
		}

		if status == "ready" {
			return result["solution"].(map[string]interface{}), nil
		}

		time.Sleep(3 * time.Second)
	}
}

👨‍💻 GO Code for solve FunCaptcha with proxy

Here's a GO sample script to accomplish the task:

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"time"
)

const (
	clientKey = "" // Replace with your actual CAPSOLVER_KEY
)

func main() {
	pageURL := "page"
	siteKey := "site key" // Replace with your proxy
	proxyURL := "http://password:username@host:port"

	taskID, err := solveFunCaptcha(pageURL, siteKey, proxy, clientKey)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	if taskID != "" {
		solution, err := getTaskResult(taskID, clientKey)
		if err != nil {
			fmt.Println("Error:", err)
			return
		}


		solutionToken, ok := solution["token"].(string)
		if !ok {
			fmt.Println("No token found in the solution")
			return
		}
		fmt.Println("Solution token:", solutionToken)


	
	}
}


func solveFunCaptcha(pageURL, websitePublicKey,proxy, clientKey string) (string, error) {
	payload := map[string]interface{}{
		"clientKey": clientKey,
		"task": map[string]string{
			"type":       "FunCaptchaTask",
			"websiteURL": pageURL,
			"websitePublicKey": websitePublicKey,
      "proxy": proxy,
		
		},
	}

	data, err := json.Marshal(payload)

	if err != nil {
		return "", err
	}
	fmt.Println("Creating Task")
	resp, err := http.Post("https://api.capsolver.com/createTask", "application/json", bytes.NewBuffer(data))
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()

	if resp.StatusCode != 200 {
		return "", fmt.Errorf("Error creating task: Received HTTP status %d", resp.StatusCode)
	}

	var response map[string]interface{}

	err = json.NewDecoder(resp.Body).Decode(&response)
	if err != nil {
		return "", err
	}

	taskID, ok := response["taskId"].(string)
	fmt.Println("Got Task id  " + taskID)
	if !ok {
		return "", fmt.Errorf("No taskId found in the response")
	}

	return taskID, nil
}

func getTaskResult(taskID, clientKey string) (map[string]interface{}, error) {
	payload := map[string]string{
		"clientKey": clientKey,
		"taskId":    taskID,
	}

	for {
		fmt.Println("Getting Task Result")
		data, err := json.Marshal(payload)
		if err != nil {
			return nil, err
		}

		resp, err := http.Post("https://api.capsolver.com/getTaskResult", "application/json", bytes.NewBuffer(data))
		if err != nil {
			return nil, err
		}
		defer resp.Body.Close()

		if resp.StatusCode != 200 {
			return nil, fmt.Errorf("Error getting task result: Received HTTP status %d", resp.StatusCode)
		}

		var result map[string]interface{}
		err = json.NewDecoder(resp.Body).Decode(&result)
		if err != nil {
			return nil, err
		}

		status, ok := result["status"].(string)
		if !ok {
			return nil, fmt.Errorf("No status found in the response")
		}

		if status == "ready" {
			return result["solution"].(map[string]interface{}), nil
		}

		time.Sleep(3 * time.Second)
	}
}

⚠️ Change these variables

  • proxyURL: Change to your proxy, only if you use FunCaptchaTask.
  • clientKey: Obtain your API key from the Capsolver Dashboard.
  • pageURL: Replace with the URL of the website for which you wish to solve FunCaptcha
  • siteKey: Replace with the site key of the page with FunCaptcha

👀 More information

More

FunCaptcha,extension
Solution for extension's inability to recognize certain FunCaptcha images

Due to browser environment issues, the extension may encounter difficult challenges in recognizing certain images in FunCaptcha. Please follow the steps below to address this: 1. Attempt to manually solve all image challenges yourself. 2. If you still encounter new challenges or cannot proceed with the intended workflow, it indicates that your browser environment or IP has been baned. In such cases, try changing your browser environment or changeing your proxy and then attempt manual solving again. 3. If you can successfully proceed with the workflow after manually solving the challenges, it suggests that your environment is not the issue. Please report the images that the extension failed to recognize to us, and we will work on fixing it as soon as possible.

FunCaptcha

28-Nov-2023

How identify and obtain FunCaptcha data[blob]
How identify and obtain FunCaptcha data[blob]

Learn to identify and obtain FunCaptcha data[blob] for effective captcha solving. Follow our step-by-step guide on using Capsolver's tools and techniques.

FunCaptcha

20-Nov-2023

What is FunCaptcha and How to Solve with Human Score
What is FunCaptcha and How to Solve with Human Score

In this article we will teach you what funCaptcha is and how to easily solve the FunCaptcha with human score using CapSolver.

FunCaptcha

13-Nov-2023

How to solve FunCaptcha with Go
How to solve FunCaptcha with Go

In this article, we will show you how to solve FunCaptcha with Go.

FunCaptcha

28-Sep-2023

How to solve FunCaptcha with Node.JS
How to solve FunCaptcha with Node.JS

In this article, we will show you how to solve FunCaptcha with Node.JS.

FunCaptcha

26-Sep-2023

How to solve FunCaptcha with Python
How to solve FunCaptcha with Python

In this article, we will show you how to solve FunCaptcha with Python

FunCaptcha

21-Sep-2023