Wiki.Site (wiki_elixir v0.2.5) View Source

Retrieves sites from a wiki farm with the SiteMatrix extension installed.

Link to this section Summary

Functions

Get the Action API for a site

Get a single site, matching on dbname

Link to this section Functions

Specs

action_api(Wiki.Site.Spec.t()) :: String.t()

Get the Action API for a site

Wiki.Site.get("enwiki")
|> Wiki.Site.action_api()
# "https://en.wikipedia.org/w/api.php"

Arguments

  • site - Populated site structure.

Return value

Calculated Action API.

TODO: Only works for the default configuration, will need to autodetect otherwise.

Link to this function

get(api \\ "https://meta.wikimedia.org/w/api.php", dbname)

View Source

Specs

get(String.t(), String.t()) :: Wiki.Site.Spec.t() | nil

Get a single site, matching on dbname

Arguments

  • dbname - Wiki ID, for example "enwiki"
  • api - Action API URL

Return value

Site spec or nil if none matched.

Link to this function

get_all(api \\ "https://meta.wikimedia.org/w/api.php")

View Source

Specs

get_all(String.t()) :: Enumerable.t()

Get all sites for a wiki farm.

Arguments

  • api - Action API URL for a site participating in the farm.

Return value

List of site specifications.

TODO:

  • Memoize result for a configurable amount of time.
  • Continuation when more than 5000 sites are available.