fa-sdk-go/README.md

72 lines
1.8 KiB
Markdown
Raw Normal View History

# Go-Furaffinity-SDK
---
## IMPORTANT: THIS IS JUST A PROOF OF CONCEPT AT THE MOMENT
This SDK misses many features and is not optimized in any way. Please use it with caution!
---
This is a Go SDK for interacting with Furaffinity. It provides functionalities to parse dates, handle cookies, and fetch
submission data from Furaffinity.
## Directory Structure
The project is organized into several packages:
- ``furaffinaty``: Contains the main client for interacting with Furaffinity.
- ``models``: Defines the data structures used in the project.
- ``utils``: Provides utility functions such as date parsing.
## Usage
First, initialize a new Furaffinity client with your username and cookies:
```go
cookies := models.Cookie{
A: os.Getenv("COOKIE_A"),
B: os.Getenv("COOKIE_B"),
}
collyOptions := []colly.CollectorOption{
colly.Debugger(&debug.LogDebugger{}),
}
faClient := furaffinaty.NewClient("YourUsername", cookies, collyOptions)
```
You can then use the client to fetch submission IDs:
````go
SubmissionIDs, err := faClient.GetSubmissionIDs()
if err != nil {
log.Fatal(err)
}
````
And fetch submissions:
````go
submissions, err := faClient.GetSubmissions(1) // Fetch 1 submission
if err != nil {
log.Fatal(err)
}
````
## Dependencies
This project uses the following dependencies:
- `github.com/gocolly/colly/v2`: For web scraping.
- `github.com/davecgh/go-spew/spew`: For pretty-printing variables for debugging.
- `github.com/joho/godotenv/autoload`: For loading environment variables from a .env file.
## Environment Variables
The project uses the following environment variables:
- ``COOKIE_A``: Your Furaffinity cookie A.
- ``COOKIE_B``: Your Furaffinity cookie B.
These should be set in your environment or in a ``.env`` file in the root directory of the project.