package module
v0.0.0-...-2d5d62b Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2021 License: BSD-3-Clause Imports: 15 Imported by: 1


Go language API wrapper for Fur Affinity, since they don't provide any API whatsoever. Parses HTML responses.




This section is empty.


View Source
var (
	ErrNotLoggedIn = errors.New("not logged in")


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

Client is a FurAffinity client.

func New

func New(config Config) (*Client, error)

New creates a new Client with the given configuration.

func (*Client) Close

func (c *Client) Close()

func (*Client) GetSubmissionDetails

func (c *Client) GetSubmissionDetails(id int64) (*SubmissionDetails, error)

func (*Client) GetUsername

func (c *Client) GetUsername() (string, error)

GetUsername makes a request to FA to verify that the provided cookies result in being logged in by finding our username. Returns ErrNotLoggedIn if username could not be found.

func (*Client) NewSearch

func (c *Client) NewSearch(query string) *Search

NewSearch creates a new search for the given query.

func (*Client) NewUser

func (c *Client) NewUser(name string) *User

type Config

type Config struct {
	Cookies []Cookie
	Proxy   string
	// RateLimit is how often requests to furaffinity.net itself are allowed.
	// Requests to e.g. facdn.net to download images are not affected.
	RateLimit time.Duration
	// RequestTimeout is the timeout for a single attempt at the request.
	RequestTimeout time.Duration
	RetryDelay     time.Duration
	RetryLimit     int
	// Timeout is the timeout on the entire request, including retries.
	Timeout   time.Duration
	UserAgent string

Config is the configuration for the client.

type Cookie struct {
	Name  string
	Value string

type Journal

type Journal struct {
	ID    int64
	Title string
	User  string
	// contains filtered or unexported fields

Journal is a journal entry.

func (Journal) String

func (j Journal) String() string

func (*Journal) URL

func (j *Journal) URL() string

type Rating

type Rating string

Rating is the decency rating of a submission.

const (
	RatingGeneral Rating = "general"
	RatingMature  Rating = "mature"
	RatingAdult   Rating = "adult"

Rating values

type Search struct {
	// contains filtered or unexported fields

func (*Search) GetPage

func (s *Search) GetPage(page int) ([]*Submission, error)

GetPage returns the search results on the given page. The page numbering starts at 1.

type Submission

type Submission struct {
	ID         int64
	PreviewURL string
	Rating     Rating
	Title      string
	User       string
	// contains filtered or unexported fields

Submission is an artwork submission.

func (*Submission) Details

func (s *Submission) Details() (*SubmissionDetails, error)

func (*Submission) PreviewImage

func (s *Submission) PreviewImage() ([]byte, error)

func (Submission) String

func (s Submission) String() string

type SubmissionDetails

type SubmissionDetails struct {
	DownloadURL string
	// contains filtered or unexported fields

SubmissionDetails are the details of a specific submission. TODO add more stuff here

func (*SubmissionDetails) Download

func (sd *SubmissionDetails) Download() ([]byte, error)

type User

type User struct {
	// contains filtered or unexported fields

func (*User) GetJournals

func (u *User) GetJournals(page uint) ([]*Journal, error)

GetJournals retrieves the specified page of the user's journal. Page numbering starts at 1.

func (*User) GetRecent

func (u *User) GetRecent() ([]*Submission, []*Journal, error)

GetRecent retrieves the user's most recent submissions and journal. It obtains the data from the user's profile page, so the number of results is limited.

func (*User) GetSubmissions

func (u *User) GetSubmissions(page uint) ([]*Submission, error)

GetSubmissions retrieves the specified page of the user's gallery. Page numbering starts at 1. NOTE: Rating information is currently not provided on the submissions.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL