Documentation
¶
Index ¶
- type WikipediaPage
- func (page *WikipediaPage) ContinuedQuery(args map[string]string) ([]interface{}, error)
- func (page WikipediaPage) Equal(other WikipediaPage) bool
- func (page *WikipediaPage) GetCategory() ([]string, error)
- func (page *WikipediaPage) GetContent() (string, error)
- func (page *WikipediaPage) GetCoordinate() ([]float64, error)
- func (page *WikipediaPage) GetHTML() (string, error)
- func (page *WikipediaPage) GetImagesURL() ([]string, error)
- func (page *WikipediaPage) GetLink() ([]string, error)
- func (page *WikipediaPage) GetParentID() (float64, error)
- func (page *WikipediaPage) GetReference() ([]string, error)
- func (page *WikipediaPage) GetRevisionID() (float64, error)
- func (page *WikipediaPage) GetSection(section string) (string, error)
- func (page *WikipediaPage) GetSectionList() ([]string, error)
- func (page *WikipediaPage) GetSectionTreeList() ([]utils.WikiMenuTreeList, error)
- func (page *WikipediaPage) GetSummary() (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WikipediaPage ¶
type WikipediaPage struct {
PageID int `json:"pageid"`
Title string `json:"title"`
OriginalTitle string `json:"originaltitle"`
Content string `json:"content"`
HTML string `json:"html"`
URL string `json:"fullurl"`
RevisionID float64 `json:"revid"`
ParentID float64 `json:"parentid"`
Summary string `json:"summary"`
CheckedImage bool `json:"checkedimage"`
Images []string `json:"images"`
Coordinate []float64 `json:"coordinates"`
Reference []string `json:"references"`
Link []string `json:"links"`
Category []string `json:"categories"`
Section []string `json:"sections"`
SectionOffset map[string][]int `json:"sectionoffset"`
Disambiguation []string `json:"disambiguation"`
SectionTreeList []utils.WikiMenuTreeList `json:"sectionTreeList"`
}
Result after we parse the response of Wikipedia API. Some attributes must be get manually using the WikipediaPage methods
func MakeWikipediaPage ¶
func MakeWikipediaPage(pageid int, title string, originaltitle string, redirect bool) (WikipediaPage, error)
Load basic information from Wikipedia.
Confirm that page exists. If it's a disambiguation page, get a list of suggesting
func (*WikipediaPage) ContinuedQuery ¶
func (page *WikipediaPage) ContinuedQuery(args map[string]string) ([]interface{}, error)
Based on <https://www.mediawiki.org/wiki/API:Query#Continuing_queries>
func (WikipediaPage) Equal ¶
func (page WikipediaPage) Equal(other WikipediaPage) bool
Return true if the 2 pages are the same
func (*WikipediaPage) GetCategory ¶
func (page *WikipediaPage) GetCategory() ([]string, error)
List of categories of a page.
func (*WikipediaPage) GetContent ¶
func (page *WikipediaPage) GetContent() (string, error)
Get the string content of the page. Save it into the page.Content for later use
func (*WikipediaPage) GetCoordinate ¶
func (page *WikipediaPage) GetCoordinate() ([]float64, error)
Slice of float64 in the form of (lat, lon)
func (*WikipediaPage) GetHTML ¶
func (page *WikipediaPage) GetHTML() (string, error)
Get the html of the page. Save it into the page.HTML for later use\
**Warning:: This can get pretty slow on long pages.
func (*WikipediaPage) GetImagesURL ¶
func (page *WikipediaPage) GetImagesURL() ([]string, error)
List of URLs of images on the page.
func (*WikipediaPage) GetLink ¶
func (page *WikipediaPage) GetLink() ([]string, error)
List of titles of Wikipedia page links on a page.
**Note:: Only includes articles from namespace 0, meaning no Category, User talk, or other meta-Wikipedia pages.
func (*WikipediaPage) GetParentID ¶
func (page *WikipediaPage) GetParentID() (float64, error)
Revision ID of the parent version of the current revision of this page.
See “revision_id“ for more information.
func (*WikipediaPage) GetReference ¶
func (page *WikipediaPage) GetReference() ([]string, error)
List of URLs of external links on a page.
May include external links within page that aren't technically cited anywhere.
func (*WikipediaPage) GetRevisionID ¶
func (page *WikipediaPage) GetRevisionID() (float64, error)
Get the revid of the page. Save it into the page.HTML for later use
The revision ID is a number that uniquely identifies the current version of the page. It can be used to create the permalink or for other direct API calls. See Help:Page history <http://en.wikipedia.org/wiki/Wikipedia:Revision> for more information.
func (*WikipediaPage) GetSection ¶
func (page *WikipediaPage) GetSection(section string) (string, error)
func (*WikipediaPage) GetSectionList ¶
func (page *WikipediaPage) GetSectionList() ([]string, error)
List of section titles from the table of contents on the page.
func (*WikipediaPage) GetSectionTreeList ¶
func (page *WikipediaPage) GetSectionTreeList() ([]utils.WikiMenuTreeList, error)
List of section titles from the table of contents on the page. 以树形结构返回
func (*WikipediaPage) GetSummary ¶
func (page *WikipediaPage) GetSummary() (string, error)
String summary of a page