godestone

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 12 Imported by: 1

README

godestone

Documentation Badge Codacy Badge Go Report Card Dependencies Repo Size

Go scraper for The Lodestone.

Installation

Just add the package to your go.mod or run go get github.com/karashiiro/godestone.

Usage

Refer to the examples/ folder for basic usage.

Contributing

Make sure to checkout the submodules if you are changing pack information.

Dependencies
Repacking

To repack the submodules, just run generate.sh.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scraper

type Scraper struct {
	// contains filtered or unexported fields
}

Scraper is the object through which interactions with The Lodestone are made.

func NewScraper

func NewScraper(lang SiteLang) *Scraper

NewScraper creates a new instance of the Scraper. Do note that all five language-versions of the website are on the same physical servers in Japan. Changing the language of the website will not meaningfully improve response times.

func (*Scraper) FetchCWLS

func (s *Scraper) FetchCWLS(id string) (*models.CWLS, error)

FetchCWLS returns CWLS information for the provided CWLS ID. The error is returned if the request fails.

func (*Scraper) FetchCharacter

func (s *Scraper) FetchCharacter(id uint32) (*models.Character, error)

FetchCharacter returns character information for the provided Lodestone ID. This function makes two requests: one to the base character profile, and another to the class and job page, returning an error if either request fails.

func (*Scraper) FetchCharacterAchievements

func (s *Scraper) FetchCharacterAchievements(id uint32) chan *models.AchievementInfo

FetchCharacterAchievements returns unlocked achievement information for the provided Lodestone ID. The error is returned if the request fails with anything other than a 403. A 403 will be raised when the character's achievements are private. Instead of raising an error, the object in the return channel will have its private flag set to `true`.

func (*Scraper) FetchCharacterMinions

func (s *Scraper) FetchCharacterMinions(id uint32) ([]*models.Minion, error)

FetchCharacterMinions returns unlocked minion information for the provided Lodestone ID. The error is returned if the request fails with anything other than a 404. A 404 can result from a character not existing, but it can also result from a character not having any minions.

func (*Scraper) FetchCharacterMounts

func (s *Scraper) FetchCharacterMounts(id uint32) ([]*models.Mount, error)

FetchCharacterMounts returns unlocked mount information for the provided Lodestone ID. The error is returned if the request fails with anything other than a 404. A 404 can result from a character not existing, but it can also result from a character not having any mounts.

func (*Scraper) FetchFreeCompany

func (s *Scraper) FetchFreeCompany(id string) (*models.FreeCompany, error)

FetchFreeCompany returns Free Company information for the provided Free Company ID. The error is returned if the request fails.

func (*Scraper) FetchFreeCompanyMembers

func (s *Scraper) FetchFreeCompanyMembers(id string) chan *models.FreeCompanyMember

FetchFreeCompanyMembers returns Free Company member information for the provided Free Company ID. The error is returned if the request fails.

func (*Scraper) FetchLinkshell

func (s *Scraper) FetchLinkshell(id string) (*models.Linkshell, error)

FetchLinkshell returns linkshell information for the provided linkshell ID. The error is returned if the request fails.

func (*Scraper) FetchPVPTeam

func (s *Scraper) FetchPVPTeam(id string) (*models.PVPTeam, error)

FetchPVPTeam returns PVP team information for the provided PVP team ID. The error is returned if the request fails.

func (*Scraper) SearchCWLS

func (s *Scraper) SearchCWLS(opts search.CWLSOptions) chan *models.CWLSSearchResult

SearchCWLS returns a channel of searchable crossworld linkshells. Please note that searches are notoriously poor, and often return exact matches far down in the results, or else return no search results when search results should be present. This library does one retry on each failure, but this is not a guarantee that all search results will be returned.

func (*Scraper) SearchCharacters

func (s *Scraper) SearchCharacters(opts search.CharacterOptions) chan *models.CharacterSearchResult

SearchCharacters returns a channel of searchable characters. Please note that searches are notoriously poor, and often return exact matches far down in the results, or else return no search results when search results should be present. This library does one retry on each failure, but this is not a guarantee that all search results will be returned.

func (*Scraper) SearchFreeCompanies

func (s *Scraper) SearchFreeCompanies(opts search.FreeCompanyOptions) chan *models.FreeCompanySearchResult

SearchFreeCompanies returns a channel of searchable Free Companies. Please note that searches are notoriously poor, and often return exact matches far down in the results, or else return no search results when search results should be present. This library does one retry on each failure, but this is not a guarantee that all search results will be returned.

func (*Scraper) SearchLinkshells

func (s *Scraper) SearchLinkshells(opts search.LinkshellOptions) chan *models.LinkshellSearchResult

SearchLinkshells returns a channel of searchable linkshells. Please note that searches are notoriously poor, and often return exact matches far down in the results, or else return no search results when search results should be present. This library does one retry on each failure, but this is not a guarantee that all search results will be returned.

func (*Scraper) SearchPVPTeams

func (s *Scraper) SearchPVPTeams(opts search.PVPTeamOptions) chan *models.PVPTeamSearchResult

SearchPVPTeams returns a channel of searchable PVP teams. Please note that searches are notoriously poor, and often return exact matches far down in the results, or else return no search results when search results should be present. This library does one retry on each failure, but this is not a guarantee that all search results will be returned.

type SiteLang

type SiteLang string

SiteLang represents the scraped website language.

const (
	JA SiteLang = "jp"
	EN SiteLang = "na"
	FR SiteLang = "fr"
	DE SiteLang = "de"
)

Lodestone website language. Do note that all five language-versions of the website (`eu` not listed) are on the same physical servers in Japan. Changing the language of the website will not meaningfully improve response times.

Directories

Path Synopsis
data
examples
achievements command
character command
cwls command
cwls-search command
freecompany command
linkshell command
minions command
mounts command
pvpteam command
pvpteam-search command
pack
css
Package main generated by go-bindata.// sources: lodestone-css-selectors/cwls/cwls.json lodestone-css-selectors/cwls/members.json lodestone-css-selectors/freecompany/focus.json lodestone-css-selectors/freecompany/freecompany.json lodestone-css-selectors/freecompany/members.json lodestone-css-selectors/freecompany/reputation.json lodestone-css-selectors/freecompany/seeking.json lodestone-css-selectors/linkshell/ls.json lodestone-css-selectors/linkshell/members.json lodestone-css-selectors/meta.json lodestone-css-selectors/profile/achievements.json lodestone-css-selectors/profile/attributes.json lodestone-css-selectors/profile/character.json lodestone-css-selectors/profile/classjob.json lodestone-css-selectors/profile/gearset.json lodestone-css-selectors/profile/minion.json lodestone-css-selectors/profile/mount.json lodestone-css-selectors/pvpteam/members.json lodestone-css-selectors/pvpteam/pvpteam.json lodestone-css-selectors/search/character.json lodestone-css-selectors/search/cwls.json lodestone-css-selectors/search/freecompany.json lodestone-css-selectors/search/linkshell.json lodestone-css-selectors/search/pvpteam.json
Package main generated by go-bindata.// sources: lodestone-css-selectors/cwls/cwls.json lodestone-css-selectors/cwls/members.json lodestone-css-selectors/freecompany/focus.json lodestone-css-selectors/freecompany/freecompany.json lodestone-css-selectors/freecompany/members.json lodestone-css-selectors/freecompany/reputation.json lodestone-css-selectors/freecompany/seeking.json lodestone-css-selectors/linkshell/ls.json lodestone-css-selectors/linkshell/members.json lodestone-css-selectors/meta.json lodestone-css-selectors/profile/achievements.json lodestone-css-selectors/profile/attributes.json lodestone-css-selectors/profile/character.json lodestone-css-selectors/profile/classjob.json lodestone-css-selectors/profile/gearset.json lodestone-css-selectors/profile/minion.json lodestone-css-selectors/profile/mount.json lodestone-css-selectors/pvpteam/members.json lodestone-css-selectors/pvpteam/pvpteam.json lodestone-css-selectors/search/character.json lodestone-css-selectors/search/cwls.json lodestone-css-selectors/search/freecompany.json lodestone-css-selectors/search/linkshell.json lodestone-css-selectors/search/pvpteam.json
exports
Package main generated by go-bindata.// sources: lodestone-data-exports/pack/achievement_table.bin lodestone-data-exports/pack/classjob_table.bin lodestone-data-exports/pack/deity_table.bin lodestone-data-exports/pack/gc_table.bin lodestone-data-exports/pack/item_table.bin lodestone-data-exports/pack/minion_table.bin lodestone-data-exports/pack/mount_table.bin lodestone-data-exports/pack/race_table.bin lodestone-data-exports/pack/reputation_table.bin lodestone-data-exports/pack/title_table.bin lodestone-data-exports/pack/town_table.bin lodestone-data-exports/pack/tribe_table.bin
Package main generated by go-bindata.// sources: lodestone-data-exports/pack/achievement_table.bin lodestone-data-exports/pack/classjob_table.bin lodestone-data-exports/pack/deity_table.bin lodestone-data-exports/pack/gc_table.bin lodestone-data-exports/pack/item_table.bin lodestone-data-exports/pack/minion_table.bin lodestone-data-exports/pack/mount_table.bin lodestone-data-exports/pack/race_table.bin lodestone-data-exports/pack/reputation_table.bin lodestone-data-exports/pack/title_table.bin lodestone-data-exports/pack/town_table.bin lodestone-data-exports/pack/tribe_table.bin

Jump to

Keyboard shortcuts

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