Avançar para o conteúdo principal

How to Use the SerpApi API with Go: Complete Tutorial for Beginners# How to Use the SerpApi API with

5 Proven Ways to Make Money Online in 2026 (Even as a Beginner)

Caption: Looking to make money online in 2026? Here are 5 legit, beginner-friendly methods that actually pay, from freelancing to selling digital products. In 2026, making money online is not about luck. It is about choosing one proven method and sticking to it for 90 days. After testing dozens of side hustles and writing technical tutorials for Dev.to and CoderLegion, I found 5 methods that work even if you have zero experience. Here is what actually pays. 1. Freelance Writing for Blogs and Businesses Every business needs content. Blogs need 2-3 articles per week to stay on Google. That is why companies pay $75 to $135 per article, even for beginners. You do not need a degree. You need 2-3 samples. Start by writing about topics you know: tech, finance, gaming, health. Use a simple structure: Problem -> Solution -> Steps. Where to find jobs: BloggingPro, ProBlogger Job Board, Contena. My first three articles earned me my first client in 7 days. The key is fast delivery and clean ...

Como usar a API SerpApi com Go: Tutorial Completo para Iniciantes [PT-BR]


CONTEÚDO PRA COPIAR E COLAR:



# Como usar a API SerpApi com Go: Tutorial Completo para Iniciantes


Olá devs! Hoje vou mostrar como integrar a SerpApi no Go em menos de 10 minutos. 

Se você é de língua portuguesa e quer extrair dados do Google sem dor de cabeça, esse tutorial é pra você.


## O que é SerpApi?


SerpApi é uma API que extrai dados do Google, Bing, Amazon e outros mecanismos de busca. 

Ela resolve CAPTCHAs e acompanha mudanças de layout pra você. Clientes incluem Nvidia, Shopify e Adobe.


## Passo 1: Pegar a API Key


1. Acesse: serpapi.com 

2. Crie uma conta gratuita. Você ganha 100 buscas/mês.


## Passo 2: Criar o Projeto em Go


Crie 2 arquivos:


### 1. `go.mod`

go

module github.com/seuuser/serpapi-go-search


go 1.21



### 2. `main.go`

go

package main


import (

 "encoding/json"

 "fmt"

 "io"

 "log"

 "net/http"

 "net/url"

 "os"

)


type SearchResult struct {

 OrganicResults []OrganicResult json:"organic_results"

}


type OrganicResult struct {

 Title string json:"title"

 Link string json:"link"

 Snippet string json:"snippet"

}


func main() {

 apiKey := os.Getenv("SERPAPI_KEY")

 if apiKey == "" {

  log.Fatal("Erro: Defina SERPAPI_KEY. Ex: export SERPAPI_KEY=sua_key")

 }

 query := "vagas de desenvolvedor Go Brasil"

 fmt.Printf("Buscando por: %s\n", query)

 results, err := searchGoogle(query, apiKey)

 if err!= nil {

  log.Fatal(err)

 }


 for i, result := range results.OrganicResults {

  if i >= 3 { break }

  fmt.Printf("%d. %s\n", i+1, result.Title)

  fmt.Printf(" %s\n", result.Link)

  fmt.Printf(" %s\n", result.Snippet)

 }

}


func searchGoogle(query string, apiKey string) (*SearchResult, error) {

 params := url.Values{}

 params.Add("engine", "google")

 params.Add("q", query)

 params.Add("api_key", apiKey)

 params.Add("hl", "pt") // Resultados em português

 resp, err := http.Get("https://serpapi.com/search?" + params.Encode())

 if err!= nil {

  return nil, err

 }

 defer resp.Body.Close()


 body, _ := io.ReadAll(resp.Body)

 var result SearchResult

 json.Unmarshal(body, &result)

 return &result, nil

}



## Passo 3: Rodar o Projeto


No terminal:

bash

export SERPAPI_KEY=sua_api_key_aqui

go run main.go



## Código Completo no GitHub


Deixei o projeto completo aqui: [github.com/Aureliopires186/SerpApi-Go-Search](https://github.com/Aureliopires186/SerpApi-Go-Search)


## Conclusão


Com 30 linhas de Go você já consegue extrair dados do Google de forma profissional. 

A SerpApi é perfeita pra devs que querem focar no produto e não em resolver CAPTCHA.


Se você é dev de língua portuguesa e tem dúvidas, me chama no Telegram: [@PiresAurelio](https://t.me/PiresAurelio)


Qual próximo tutorial vocês querem? Comenta aí 👇


#go #golang #serpapi #api #programacao #portugues


Como usar a API SerpApi com Go: Tutorial Completo para Iniciantes [PT-BR]

Comentários

Pires Aurélio