wikipage

package module
v0.0.0-...-5695dd0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: MIT Imports: 11 Imported by: 0

README

wikipage

GoDoc Reference Build Status Go Report Card Bugs Coverage Lines of Code Maintainability Rating Reliability Rating Security Rating Vulnerabilities

Description

Package wikipage is a golang package that provides utility functions for retrieving informations about Wikipedia articles.

Installation

This package can be installed with the go get command:

go get github.com/negapedia/wikipage

Documentation

API documentation can be found in the associated godoc reference

Documentation

Overview

Package wikipage provides utility functions for retrieving informations about Wikipedia articles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFound

func NotFound(err error) (title string, ok bool)

NotFound checks if current error was issued by a page not found, if so it returns page ID and sets "ok" true, otherwise "ok" is false.

Types

type RequestHandler

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

RequestHandler is a hub from which is possible to retrieve informations about Wikipedia articles.

func New

func New(lang string) (rh RequestHandler)

New loads or creates a RequestHandler for the specified language.

func (RequestHandler) From

func (rh RequestHandler) From(ctx context.Context, title string) (p WikiPage, err error)

From returns a WikiPage from an article Title. It's safe to use concurrently. Warning: in the worst case it can block for more than 48 hours. As such it's advised to setup a timeout with the context.

type WikiPage

type WikiPage struct {
	ID       uint32 `json:"pageid"`
	Title    string
	Abstract string `json:"Extract"`
}

WikiPage represents an article of Wikipedia.

Jump to

Keyboard shortcuts

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