{"id":13837357,"url":"https://github.com/trietmn/go-wiki","last_synced_at":"2025-07-10T18:33:00.781Z","repository":{"id":62414745,"uuid":"557257090","full_name":"trietmn/go-wiki","owner":"trietmn","description":"This is a Golang open-source module that makes it easy to access and parse data from Wikipedia (Wikipedia API wrapper)","archived":false,"fork":false,"pushed_at":"2025-05-06T16:43:32.000Z","size":62,"stargazers_count":103,"open_issues_count":4,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-06T16:51:05.218Z","etag":null,"topics":["go","wikipedia","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trietmn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-25T11:09:03.000Z","updated_at":"2025-05-06T16:38:46.000Z","dependencies_parsed_at":"2023-12-06T16:43:56.858Z","dependency_job_id":null,"html_url":"https://github.com/trietmn/go-wiki","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.5,"last_synced_commit":"6a530d342a4fc11accb6912251d9871a9d91567a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/trietmn/go-wiki","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trietmn%2Fgo-wiki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trietmn%2Fgo-wiki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trietmn%2Fgo-wiki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trietmn%2Fgo-wiki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trietmn","download_url":"https://codeload.github.com/trietmn/go-wiki/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trietmn%2Fgo-wiki/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264631213,"owners_count":23640941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","wikipedia","wrapper"],"created_at":"2024-08-04T15:01:07.168Z","updated_at":"2025-07-10T18:33:00.535Z","avatar_url":"https://github.com/trietmn.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Go-wiki\n\n\u003cimg align=\"right\" width=\"159px\" src=\"https://upload.wikimedia.org/wikipedia/en/8/80/Wikipedia-logo-v2.svg\"\u003e\n\n[![go report card](https://goreportcard.com/badge/github.com/trietmn/go-wiki \"go report card\")](https://goreportcard.com/report/github.com/trietmn/go-wiki)\n[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n[![GoDoc](https://godoc.org/github.com/trietmn/go-wiki?status.svg)](https://pkg.go.dev/github.com/trietmn/go-wiki)\n\nThis is a Golang Wikipedia API wrapper - The Golang module that makes it easy to access and parse data from Wikipedia. You can use this module to crawl data for your data warehouse or use it for your \"Know-it-all\" AI Chatbot.\n\n## Contents\n\n- [Go-wiki](#go-wiki)\n  - [Contents](#contents)\n  - [Instalation](#instalation)\n  - [Documentation](#documentation)\n  - [Quick start](#quick-start)\n  - [Functions Examples](#functions-examples)\n    - [1. Search](#1-search)\n    - [2. GetPage (There are multiple page methods in the Wikipedia Page Methods)](#2-getpage-there-are-multiple-page-methods-in-the-wikipedia-page-methods)\n    - [3. Suggest](#3-suggest)\n    - [4. Geosearch](#4-geosearch)\n    - [5. GetRandom](#5-getrandom)\n    - [6. Summary](#6-summary)\n  - [Wikipedia Page Methods](#wikipedia-page-methods)\n  - [License](#license)\n  - [About me](#about-me)\n  - [Credit](#credit)\n\n## Instalation\n\nTo install Go-Wiki package, you need to install Go and set your Go workspace first.\n1. You first need [Go](https://golang.org/) installed, then you can use the below Go command to install Go-wiki.\n```sh\ngo get -u github.com/trietmn/go-wiki\n```\n2. Import it in your code.\n```go\nimport \"github.com/trietmn/go-wiki\"\n```\n\n## Documentation\n\nYou can read the documentation at: \u003chttps://pkg.go.dev/github.com/trietmn/go-wiki\u003e \n\nI will update a full tutorial article on some popular blog as soon as possiple.\n\n## Quick start\n\n```sh\n# assume the following codes in example.go file\n$ cat example.go\n```\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/trietmn/go-wiki\"\n)\n\nfunc main() {\n    // Search for the Wikipedia page title\n    search_result, _, err := gowiki.Search(\"Why is the sky blue\", 3, false)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Printf(\"This is your search result: %v\\n\", search_result)\n\n    // Get the page\n    page, err := gowiki.GetPage(\"Rafael Nadal\", -1, false, true)\n    if err != nil {\n        fmt.Println(err)\n    }\n\n    // Get the content of the page\n    content, err := page.GetContent()\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Printf(\"This is the page content: %v\\n\", content)\n}\n```\n\n```sh\n# run example.go\n$ go run example.go\n```\n\n## Functions Examples\n\nNote: The functions below are functions that you would usually use. Read the [document](https://pkg.go.dev/github.com/trietmn/go-wiki) to see all the functions.\n\n### 1. Search\n```go\nsearch_result, suggestion, err := gowiki.Search(\"Why is the sky blue\", 3, true)\nif err != nil {\n    fmt.Println(err)\n}\nfmt.Printf(\"Search result: %v\\n\", search_result)\nfmt.Printf(\"Suggestion: %v\\n\", suggestion)\n```\n\n### 2. GetPage (There are multiple page methods in the [Wikipedia Page Methods](#wikipedia-page-methods))\n```go\npage, err := gowiki.GetPage(\"Rafael Nadal\", -1, false, true)\nif err != nil {\n    fmt.Println(err)\n}\n// Then now you can use the page methods\n```\n\n### 3. Suggest\n```go\nsuggestion, err := gowiki.Suggest(\"nadal\")\nif err != nil {\n    fmt.Println(err)\n}\nfmt.Printf(\"Suggestion: %v\\n\", suggestion)\n```\n\n### 4. Geosearch\n```go\nres, err := gowiki.GeoSearch(40.67693, 117.23193, -1, \"\", -1)\nif err != nil {\n    fmt.Println(err)\n}\nfmt.Printf(\"Geosearch result: %v\\n\", res)\n```\n\n### 5. GetRandom\n```go\nres, err := gowiki.GetRandom(5)\nif err != nil {\n    fmt.Println(err)\n}\nfmt.Printf(\"Random titles: %v\\n\", res)\n```\n\n### 6. Summary\n```go\nres, err := gowiki.Summary(\"Rafael Nadal\", 5, -1, false, true)\nif err != nil {\n    fmt.Println(err)\n}\nfmt.Printf(\"Summary: %v\\n\", res)\n```\n\n## Wikipedia Page Methods\n\n| Methods        | Description                                          | Example                    |\n| -------------- | :--------------------------------------------------- | :------------------------- |\n| Equal          | Check if 2 pages are equal to each other             | page1.Equal(page2)         |\n| GetContent     | Get the page content                                 | page.GetContent()          |\n| GetHTML        | Get the page HTML                                    | page.GetHTML()             |\n| GetRevisionID  | Get revid field of a page                            | page.GetRevisionID()       |\n| GetParentID    | Get parentid field of a page                         | page.GetParentID()         |\n| GetSummary     | Get the summary of the page                          | page.GetSummary()          |\n| GetImagesURL   | Get all of the image URL appear in the page          | page.GetImageURL()         |\n| GetCoordinate  | Get the page coordinate if exist                     | page.GetCoordinate()       |\n| GetReference   | Get all of the extenal links in the page             | page.GetReference()        |\n| GetLink        | Get all the titles of Wikipedia page links on a page | page.GetLink()             |\n| GetCategory    | Get all of the categories of a page                  | page.GetCategory()         |\n| GetSectionList | Get all of the sections of the page                  | page.GetSectionList()      |\n| GetSection     | Get the content of a specific section in the page    | page.GetSection(\"History\") |\n\n## License\n\nMIT licensed. See the LICENSE file for full details.\n\n## About me\n\nConnect with me on Linkedin: \u003chttps://www.linkedin.com/in/triet-m-nguyen-a94b4b20b/\u003e\n\n## Credit\n\n- [Python Wikipedia](https://github.com/goldsmith/Wikipedia) by goldsmith as inspiration.\n- The [Wikimedia Foundation](https://wikimediafoundation.org/) for giving the world free access to data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrietmn%2Fgo-wiki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrietmn%2Fgo-wiki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrietmn%2Fgo-wiki/lists"}