battles

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ErrMoreThanOneInfoBox = domain.Error("More than one info box found")

ErrMoreThanOneInfoBox is used to communicate that more than one info box was found

View Source
const ErrNoDate = domain.Error("No date in info box")

ErrNoDate is used to communicate that the info box did not have a date

View Source
const ErrNoInfoBox = domain.Error("No info box found. Is this a battle?")

ErrNoInfoBox is used to communicate that no info box was found

View Source
const ErrNoPlace = domain.Error("No place in info box")

ErrNoPlace is used to communicate that the info box did not specify a place

View Source
const ErrNoResult = domain.Error("No results in info box")

ErrNoResult is used to communicate that the info box did not specify the results

View Source
const ErrNoSummaryExtract = domain.Error("No extract found in summary")

ErrNoSummaryExtract is used to communicate that no extract was found in the battle's summary

Variables

This section is empty.

Functions

This section is empty.

Types

type ExportedData added in v0.2.0

type ExportedData struct {
	FactionsByID   map[int]*wikiactors.Actor
	CommandersByID map[int]*wikiactors.Actor
	BattlesByID    map[int]*wikibattles.Battle
}

ExportedData is the struct used to retrieve all factions, commanders and battles that have been scraped after successive runs of scraper.ScrapeOne. All of these have been normalized by their Wikipedia IDs

type Scraper

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

Scraper is the struct encapsulating all the necessary behaviour to scrape battles, one by one, as well as exporting the results into files

func NewScraper

func NewScraper(l logger.Interface) Scraper

NewScraper creates a new instance of battles.Scraper

func (*Scraper) Data added in v0.2.0

func (s *Scraper) Data() ExportedData

Data builds a battles.ExportedData struct with all of the scraped data obtained from successive runs of scraper.ScrapeOne

func (*Scraper) ScrapeOne

func (s *Scraper) ScrapeOne(url string) (wikibattles.Battle, error)

ScrapeOne scrapes information about the battle found in the URL passed to it

Jump to

Keyboard shortcuts

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