wiki

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateApiUrl

func CreateApiUrl(rawURL string) (title string, queryUrl string, err error)

CreateApiUrl transforms a MediaWiki page URL into an API query URL. URL schemes: https://www.mediawiki.org/wiki/Manual:Short_URL Example input: https://en.wikipedia.org/wiki/Lists_of_earthquakes

func WriteCSV

func WriteCSV(table Table, f io.WriteCloser) error

Types

type Row

type Row struct {
	Cells []string
}

type Table

type Table struct {
	Rows []Row
}

func Parse

func Parse(wikiData WikiResponse, tableSelector string, cssClassNamesToExclude []string, noTrimCells bool, noIncludeLineBreaks bool) ([]Table, error)

type WikiParse

type WikiParse struct {
	PageID int      `json:"pageid"`
	Title  string   `json:"title"`
	Text   WikiText `json:"text"`
}

type WikiResponse

type WikiResponse struct {
	Parse WikiParse `json:"parse"`
}

func Fetch

func Fetch(queryUrl string, userAgent string) (*WikiResponse, error)

type WikiText

type WikiText struct {
	Content string `json:"*"`
}

Jump to

Keyboard shortcuts

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