Documentation ¶
Overview ¶
Package wikipedia is a simple client driver for the wikipedia HTTP api.
Index ¶
- Variables
- func IsProject(project string) bool
- type Article
- type ArticleMediaItem
- type ArticleSummary
- type ArticleTitles
- type ArticleURLs
- type Client
- func (c *Client) FetchTopArticles(ctx context.Context, project string) (*TopPageviews, error)
- func (c *Client) GetArticle(ctx context.Context, project, articleName string) (Article, error)
- func (c *Client) GetArticleMedia(ctx context.Context, project, articleName string) ([]ArticleMediaItem, error)
- func (c *Client) GetArticleSummary(ctx context.Context, project string, articleName string) (summary ArticleSummary, err error)
- type ContentURLs
- type ImageMetadata
- type PageViewEntry
- type Scale
- type SrcSetMetadata
- type TopPageviews
- type TopPageviewsArticle
Constants ¶
This section is empty.
Variables ¶
View Source
var Projects = []string{
"en",
"fr",
"es",
"de",
"ru",
"ja",
"nl",
"it",
"sv",
"pl",
"vi",
"pt",
"ar",
"zh",
"uk",
"ro",
"bg",
"th",
"fa",
}
Functions ¶
Types ¶
type Article ¶
type Article struct { Project string Article string Summary ArticleSummary Media []ArticleMediaItem }
func (*Article) GetImageURL ¶
type ArticleMediaItem ¶
type ArticleMediaItem struct { SectionID int `json:"section_id"` Type string `json:"type"` Titles ArticleTitles `json:"titles"` Thumbnail ImageMetadata `json:"thumbnail"` Original ImageMetadata `json:"original"` SrcSet []SrcSetMetadata `json:"srcset"` }
type ArticleSummary ¶
type ArticleSummary struct { Type string `json:"type"` Title string `json:"title"` DisplayTitle string `json:"display_title"` Titles ArticleTitles WikibaseItem string `json:"wikibase_item"` Lang string `json:"lang"` Timestamp time.Time `json:"time"` Extract string `json:"extract"` ExtractHTML string `json:"extract_html"` ContentURLs ContentURLs `json:"content_urls"` }
type ArticleTitles ¶
type ArticleURLs ¶
type ArticleURLs struct {
Page string `json:"page"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads from wikipedia.
func (*Client) FetchTopArticles ¶
func (*Client) GetArticle ¶
func (*Client) GetArticleMedia ¶
func (*Client) GetArticleSummary ¶
type ContentURLs ¶
type ContentURLs struct { Desktop ArticleURLs `json:"desktop"` Mobile ArticleURLs `json:"mobile"` }
type ImageMetadata ¶
type PageViewEntry ¶
type SrcSetMetadata ¶
type TopPageviews ¶
type TopPageviewsArticle ¶
Click to show internal directories.
Click to hide internal directories.