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

Solving 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

How to Solve Funcaptcha
How to Solve Funcaptcha by Using Python and GO

Due to the continuous development of online security measures, FunCaptcha has become an attractive and effective variant of CAPTCHA. However...

FunCaptcha

26-Apr-2024

Funcaptcha solving service
Best Arkose Labs FunCaptcha captcha solving service

Traditional captchas have been rendered ineffective by bots that can bypass them with ease. Arkose Labs' MatchKey challenges, however...

FunCaptcha

08-Mar-2024

Fastest-FunCaptcha-Solving
Fastest FunCaptcha Solving Service, Top CAPTCHA Solvers in 2024

As online security measures continue to evolve, FunCaptcha has emerged as an engaging and effective CAPTCHA variant. However...

FunCaptcha

02-Feb-2024

Captcha-Solving-Service
Captcha Solving Service, Solving reCAPTCHA/FunCaptcha/hCaptcha and Other Types of Captcha

In today's digital age, the internet is teeming with security measures to protect websites and distinguish humans from bots. One of the most commonly encountered security measures is the captcha, a challenge-response test designed to ensure that the user is a real person.

FunCaptcha

19-Jan-2024

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