NEWStandard createTask and in.php APIs. Change the address and you are connected.View API docs
GATESOLVER

Glossary

Colly: scraping and crawling in Go

Colly is an open source Go framework for scraping, built around a collector object that fetches pages and calls your functions when elements, responses or errors appear.

The collector model

Everything in Colly starts with a collector. You configure it (allowed domains, user agent, depth), register callbacks, then visit a start URL. Callbacks fire as the collector works: before a request, on a response, on each HTML element matching a selector, on errors and after scraping a page. The model reads naturally and keeps fetching, parsing and link following in one place.

package main

import (
	"fmt"

	"github.com/gocolly/colly/v2"
)

func main() {
	c := colly.NewCollector(colly.AllowedDomains("books.toscrape.com"))
	c.OnHTML("article.product_pod", func(e *colly.HTMLElement) {
		fmt.Println(e.ChildAttr("h3 a", "title"), e.ChildText(".price_color"))
	})
	c.OnHTML("li.next a[href]", func(e *colly.HTMLElement) {
		e.Request.Visit(e.Attr("href"))
	})
	c.Visit("https://books.toscrape.com/")
}

Why Go suits scraping

Go compiles to a single binary with no runtime to install, starts instantly and uses little memory per connection. Goroutines make it cheap to run hundreds of fetches at once. Colly builds on that: switch the collector to async mode and it fetches in parallel, then call c.Wait() at the end. Parsing uses goquery, which offers a jQuery like selector API in Go.

Being polite by configuration

Limit rules control pressure per domain. A rule can set parallelism, a fixed delay and a random delay for any domain matching a glob. Colly can also respect robots.txt, cache responses on disk during development, and persist visited URLs and cookies in storage backends such as Redis so a long crawl can resume. Set these before scaling up; it is easier than explaining a block later.

Limits

Colly does not run JavaScript. For pages that build content in the browser, call their JSON endpoints directly, or use a Go browser automation library such as chromedp or rod for those specific pages and keep Colly for the rest. Because Go's standard HTTP client has its own TLS fingerprint, protected sites may challenge it more readily than a browser.

Adding a CAPTCHA solve

When an OnHTML callback sees a widget, read its key and hand it to a small Go function that calls GateSolver. Keep the solver outside the callback's hot path: create the task, poll with time.Sleep(3 * time.Second) in a separate goroutine, and when the token arrives, issue the follow up POST with c.Post including the token field. In async mode many solves can run at once, since GateSolver places no limit on concurrent tasks; only the per key request rate is shared. A Cloudflare Turnstile token usually arrives under 3 seconds. The Go Colly scraping guide and solving Turnstile in Go show complete code.

Debugging a collector

Attach the debugger extension to log every request and callback while you develop, and register an OnError callback from the start so failed requests are not silently dropped. Printing the status code and the first few hundred bytes of each failed body is usually enough to tell a timeout from a block or a challenge page.

Who uses it

Colly fits teams already writing Go services who want a scraper that deploys as one binary, crawlers that must run on small machines, and jobs where raw throughput on static pages matters more than browser features.

Common questions

What language is Colly written in?

Go. It is installed as a Go module and compiled into your program.

Does Colly support parallel requests?

Yes. Enable async mode and use limit rules to set parallelism and delays per domain, then wait for completion.

Can Colly render JavaScript?

No. Pair it with a Go browser library such as chromedp or rod for pages that need rendering.

Which selector syntax does Colly use?

CSS selectors through goquery, a jQuery style library for Go.

How do I send a solved token with Colly?

Use the collector Post method with the form fields, including the token field the page expects.

Keep reading