Files
go-fa-api/doc.go
2026-05-25 22:27:18 +02:00

43 lines
1.5 KiB
Go

// Package fa is a Go SDK for FurAffinity (https://www.furaffinity.net).
//
// FurAffinity exposes no JSON API, so this package scrapes the rendered
// HTML of the site's beta theme using Colly internally, and presents a
// strongly typed surface to callers.
//
// # Quickstart
//
// client := fa.New(
// fa.WithCookies(fa.Cookies{A: os.Getenv("FA_A"), B: os.Getenv("FA_B")}),
// fa.WithCloudflare(fa.CFCookies{Clearance: os.Getenv("CF_CLEARANCE")}),
// fa.WithUserAgent(os.Getenv("FA_UA")),
// )
//
// sub, err := client.GetSubmission(ctx, 12345678)
// if err != nil {
// return err
// }
// fmt.Println(sub.Title, "by", sub.Author.DisplayName)
//
// for sub, err := range client.Gallery(ctx, "someuser", fa.ListOptions{MaxPages: 3}) {
// if err != nil {
// return err
// }
// fmt.Println(sub.ID, sub.Title)
// }
//
// # Rate limiting
//
// All HTTP requests, including file downloads from the CDN, pass through a
// single token-bucket rate limiter. The default is one request per second,
// which is the lowest safe value for unauthenticated browsing of the site.
// Callers cannot bypass it; it lives inside the [http.RoundTripper].
//
// # Cloudflare
//
// FurAffinity sits behind Cloudflare. To pass challenge pages, callers must
// supply a fresh cf_clearance cookie obtained from a real browser, along
// with the exact User-Agent string that produced it. If the SDK receives a
// challenge response it returns [ErrCloudflareChallenge]; the caller should
// refresh the clearance cookie and retry.
package fa