Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Go interface to the Wikimedia (Wikipedia, Wiktionary, etc.) API
Go
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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)
}
Something went wrong with that request. Please try again.