A Go interface to the Wikimedia (Wikipedia, Wiktionary, etc.) API
Go
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README
wikimedia.go

README

go-wikimedia is an interface to the Wikimedia (Wikipedia, Wiktionary, etc.) API.

It is a work in progress currently used to build applications that query
Wikipedia and Wiktionary in different languages.

== Installation

go get github.com/pmylund/go-wikimedia

== Documentation

go doc github.com/pmylund/go-wikimedia
or http://go.pkgdoc.org/github.com/pmylund/go-wikimedia

== Usage

import (
	"fmt"
	"github.com/pmylund/go-wikimedia"
	"net/url"
)

w, err := wikimedia.New("http://en.wikipedia.org/w/api.php")
if err != nil {
	...
}
f := url.Values{
	"action": {"query"},
	"prop":   {"extracts"},
	"titles": {"Osmosis|Procrastination"},
}
res, err := w.Query(f)
if err != nil {
	return nil, err
}
for _, v := range res.Query.Pages {
	fmt.Println(v.Title, "-", v.Extract)
}