|
@ -21,14 +21,17 @@ const maxExtractLength = 1024 // Max length of extract string in bytes |
|
|
|
|
|
|
|
|
var httpClient = &http.Client{} |
|
|
var httpClient = &http.Client{} |
|
|
|
|
|
|
|
|
|
|
|
// Search results (returned by search query)
|
|
|
type wikipediaSearchResults struct { |
|
|
type wikipediaSearchResults struct { |
|
|
Query wikipediaQuery `json:"query"` |
|
|
Query wikipediaQuery `json:"query"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Wikipeda pages returned in search results
|
|
|
type wikipediaQuery struct { |
|
|
type wikipediaQuery struct { |
|
|
Pages map[string]wikipediaPage `json:"pages"` |
|
|
Pages map[string]wikipediaPage `json:"pages"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Representation of an individual wikipedia page
|
|
|
type wikipediaPage struct { |
|
|
type wikipediaPage struct { |
|
|
PageID int64 `json:"pageid"` |
|
|
PageID int64 `json:"pageid"` |
|
|
NS int `json:"ns"` |
|
|
NS int `json:"ns"` |
|
|