Skip to content

astrocode-id/go-flaresolverr

Repository files navigation

FlareSolverr v3 Go Client

License: MIT Code Climate Test Coverage GitHub issues CircleCI FOSSA Status

go-flaresolverr is Golang client for FlareSolverr v3.

Installation

  1. Install FlareSolverr
  2. Get go-flaresolverr
go get github.com/astrocode-id/go-flaresolverr

Examples

Get Page

Retrieves webpage using request.get command.

package main

import (
	"fmt"
	"log"

	"github.com/PuerkitoBio/goquery"

	"github.com/astrocode-id/go-flaresolverr"
)

func main() {
	c, err := flaresolverr.NewClient(flaresolverr.Config{
		BaseURL: baseURL,
	})
	if err != nil {
		log.Fatal(err)
	}

	b, err := c.Get(flaresolverr.GetParams{
		URL: "https://ifconfig.me",
	})
	if err != nil {
		log.Fatal(err)
	}

	doc, err := goquery.NewDocumentFromReader(bytes.NewReader(b))
	if err != nil {
		log.Fatal(err)
	}

	ipAddress := doc.Find("strong").First().Text()
	fmt.Println(ipAddress)
}

Post Page

Retrieves webpage using request.post command.

TODO

Note

License

FOSSA Status