Documentation ¶
Index ¶
- func AtoiWithComma(s string) (int, error)
- func InitAO3Client(client *http.Client, sanitizationPolicy SanitizationPolicy) (*AO3Client, *AO3Error)
- type AO3Client
- func (client *AO3Client) DownloadWork(path string) ([]byte, *AO3Error)
- func (client *AO3Client) GetFandomCategories() ([]FandomCategory, *AO3Error)
- func (client *AO3Client) GetFandomCategory(category string) ([]Fandom, *AO3Error)
- func (client *AO3Client) GetSeries(id string) (*Series, *AO3Error)
- func (client *AO3Client) GetTagWorks(tag string, page int) (*TagWorks, *AO3Error)
- func (client *AO3Client) GetWork(id string) (*Work, *AO3Error)
- type AO3Error
- type Fandom
- type FandomCategory
- type IndexedWork
- type Link
- type SanitizationPolicy
- type Sanitizer
- type Series
- type TagWorks
- type Work
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtoiWithComma ¶
AtoiWithComma performs strconv.Atoi, removing commas from the string
func InitAO3Client ¶
func InitAO3Client(client *http.Client, sanitizationPolicy SanitizationPolicy) (*AO3Client, *AO3Error)
InitAO3Client optionally takes in two parameters:
- client, the HTTP client to use (especially useful to configure timeouts and use custom clients, for example, with Google Cloud Platform);
- sanitizerStrength, the sanitization policy for sanitization of blurbs,e tc. (NonePolicy performs no sanitization)
Types ¶
type AO3Client ¶
AO3Client contains configuration parameters for the package
func (*AO3Client) DownloadWork ¶
DownloadWork downloads the work and returns a byte array
func (*AO3Client) GetFandomCategories ¶
func (client *AO3Client) GetFandomCategories() ([]FandomCategory, *AO3Error)
GetFandomCategories scrapes the fandoms list.
Endpoint: https://archiveofourown.org/media
func (*AO3Client) GetFandomCategory ¶
GetFandomCategory returns a list of all the fandoms under a category.
Endpoint: https://archiveofourown.org/media/[category]/fandoms Example: https://archiveofourown.org/media/Anime%20*a*%20Manga/fandoms
func (*AO3Client) GetTagWorks ¶
GetTagWorks returns a paginated list of works from a tag. A tag can represent fandoms, characters, etc.
Endpoint: https://archiveofourown.org/tags/[tag]/works?page=[page] Example: https://archiveofourown.org/tags/Action*s*Adventure/works
type FandomCategory ¶
type IndexedWork ¶
type IndexedWork struct { Title string Slug string LastUpdated string IsAnonymous bool Authors []Link Recipients []Link Rating string Warnings string Category string Status string FandomTags []Link WarningTags []Link RelationshipTags []Link CharacterTags []Link FreeformTags []Link IsSeries bool Series Link SeriesPart int Summary string Language string Words int Chapters string Comments int Kudos int Bookmarks int Hits int }
IndexedWork represents a work listed in a list of tags
type SanitizationPolicy ¶
type SanitizationPolicy int
const ( // NonePolicy instructs the sanitizer not to perform any sanitization NonePolicy SanitizationPolicy = 0 // AO3Policy instructs the sanitizer to only keep AO3's limited HTML tags AO3Policy SanitizationPolicy = 1 // AO3AndroidPolicy instructs the sanitizer to keep the AO3Policy tags // which are supported by Android's TextView AO3AndroidPolicy SanitizationPolicy = 2 )
type Sanitizer ¶
type Sanitizer struct {
// contains filtered or unexported fields
}
func NewSanitizer ¶
func NewSanitizer(strength SanitizationPolicy) (*Sanitizer, error)
type Series ¶
type Series struct { Title string IsAnonymous bool Creators []Link Begun string Updated string Description string Notes string Words int NumWorks int IsComplete bool Bookmarks int Works []IndexedWork }
Series is a representation of the series page
type TagWorks ¶
type TagWorks struct { Works []IndexedWork Count int // Pagination-related values IsPaginated bool CurrentPage int LastPage int }
TagWorks is a represented of a paginated /tags/.../works page
type Work ¶
type Work struct { Title string IsAnonymous bool Authors []Link RatingTags []Link FandomTags []Link WarningTags []Link CategoryTags []Link CharacterTags []Link FreeformTags []Link IsSeries bool Series Link SeriesPart int Language string Published string Updated string Words int Chapters string Comments int Kudos int Bookmarks int Hits int Summary string HTMLDownloadSlug string }