{"id":15134686,"url":"https://github.com/iwannabebot/sharpwiki","last_synced_at":"2026-02-10T22:05:12.326Z","repository":{"id":120768421,"uuid":"587771667","full_name":"iwannabebot/SharpWiki","owner":"iwannabebot","description":"A tiny C# api client for Wikipedia","archived":false,"fork":false,"pushed_at":"2025-02-12T17:24:57.000Z","size":78,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-22T07:33:27.864Z","etag":null,"topics":["mediawiki","mediawiki-api","wiki","wikipedia","wikipedia-api"],"latest_commit_sha":null,"homepage":"","language":"C#","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/iwannabebot.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,"zenodo":null}},"created_at":"2023-01-11T14:51:19.000Z","updated_at":"2025-02-12T17:22:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b4cf650-9f7f-4ff8-9a07-81239a13da20","html_url":"https://github.com/iwannabebot/SharpWiki","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/iwannabebot/SharpWiki","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwannabebot%2FSharpWiki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwannabebot%2FSharpWiki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwannabebot%2FSharpWiki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwannabebot%2FSharpWiki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwannabebot","download_url":"https://codeload.github.com/iwannabebot/SharpWiki/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwannabebot%2FSharpWiki/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267652709,"owners_count":24122096,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["mediawiki","mediawiki-api","wiki","wikipedia","wikipedia-api"],"created_at":"2024-09-26T05:23:46.970Z","updated_at":"2026-02-10T22:05:12.277Z","avatar_url":"https://github.com/iwannabebot.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![SharpWiki](https://repository-images.githubusercontent.com/587771667/ae99da4e-ef94-4c66-a9a9-b7d66956e27e)\n# SharpWiki\nA tiny C# api client for Wikipedia\n\n![CI](https://github.com/iwannabebot/sharpwiki/actions/workflows/dotnet.yml/badge.svg)\n![CodeQL](https://github.com/iwannabebot/sharpwiki/actions/workflows/codeql.yml/badge.svg)\n![Nuget](https://github.com/iwannabebot/sharpwiki/actions/workflows/nuget.yml/badge.svg)\n\u003c/div\u003e\n\n\n#### Install from Nuget\n\n[![NuGet version (SharpWiki)](https://img.shields.io/nuget/v/SharpWiki?label=SharpWiki\u0026logo=nuget)](https://www.nuget.org/packages/SharpWiki/)\n\n\n```pwsh\nInstall-Package SharpWiki\n```\n\n### Status\n\n\n\n### Supported APIs\n|Support|Resource|Operation|\n|-------|--------|----------|\n|✅|Search|Page|\n|✅|Search|Title|\n|✅|Page|Create|\n|✅|Page|Update|\n|✅|Page|Get|\n|✅|Page|Get Offline|\n|✅|Page|Get Source|\n|✅|Page|Get HTML|\n|✅|Page|Get Languages|\n|✅|Page|Get Files|\n|✅|Media|Get|\n|❌|History|Get Page History|\n|❌|History|Get Page History Counts|\n|❌|History|Get Revision|\n|❌|History|Compare Revisions|\n\n#### Quick Start\n\nThis client will use English wikipedia's API. To change settings use `SharpWikiClientOptions` and pass the parameter in `SharpWikiClient`\n\n```cs\n// Initialize SharpWikiClient\nusing SharpWikiClient client= new SharpWikiClient();\n\n// Search page\n// This will search entire wikipedia page\nWikiSearch searchPages = await client.SearchPagesAsync(\"Jupiter\", 5);\nforeach(WikiSearchPage page in searchPages.Pages)\n{\n    Console.WriteLine($\"{page.Id}\");\n    Console.WriteLine($\"{page.Title}\");\n    Console.WriteLine($\"{page.Description}\");\n    Console.WriteLine($\"{page.Thumbnail.Url}\");\n}\n\n// Search title\n// This will search wikipedia titles only\n// A good use case is to use this for autocomplete\nWikiSearch searchTitles = await client.SearchTitleAsync(\"Jupiter\", 5);\nforeach (WikiSearchPage page in searchTitles.Pages)\n{\n    Console.WriteLine($\"{page.Id}\");\n    Console.WriteLine($\"{page.Title}\");\n}\n```\n\n##### Get Page\n```cs\n// Get a wiki page by title\nWikiPage page= await client.GetPageAsync(\"Jupiter\");\nConsole.WriteLine($\"{page.Id}\");\nConsole.WriteLine($\"{page.Title}\");\nConsole.WriteLine($\"{page.HtmlUrl}\");\n\n// Get a wiki page by title with html\nWikiPage offlinePage = await client.GetPageOfflineAsync(\"Jupiter\");\nConsole.WriteLine($\"{offlinePage.Id}\");\nConsole.WriteLine($\"{offlinePage.Title}\");\nConsole.WriteLine($\"{offlinePage.Html}\");\n\n// Get a wiki page by title with original source\n// Read more about source types from https://www.mediawiki.org/wiki/Content_handlers\nWikiPage sourcePage = await client.GetPageSourceAsync(\"Jupiter\");\nConsole.WriteLine($\"{offlinePage.Id}\");\nConsole.WriteLine($\"{offlinePage.Title}\");\nConsole.WriteLine($\"{offlinePage.Source}\");\n\n// Get a wiki page by title as HTML\nstring wikiPageHtml = await client.GetPageHtmlAsync(\"Jupiter\");\nConsole.WriteLine($\"{wikiPageHtml}\");\n```\n\n##### Get Page in all languages\n```cs\n// Get list of languages in which this title is also present\nIEnumerable\u003cWikiPageLanguage\u003e pageLanguages = await client.GetPageLanguagesAsync(\"Jupiter\");\nforeach(WikiPageLanguage pageLanguage in pageLanguages)\n{\n    Console.WriteLine($\"{pageLanguage.Name}\");\n    Console.WriteLine($\"{pageLanguage.Code}\");\n    Console.WriteLine($\"{pageLanguage.Title}\");\n    Console.WriteLine($\"{pageLanguage.Key}\");\n}\n```\n\n##### Get Files on Page\n```cs\n// Get list of files present on a wiki page\nIEnumerable\u003cWikiFile\u003e filesOnPage = await client.GetFilesOnPageAsync(\"Jupiter\");\nforeach (WikiFile fileOnPage in filesOnPage)\n{\n    Console.WriteLine($\"{fileOnPage.Title}\");\n    Console.WriteLine($\"{fileOnPage.Original.Url}\");\n}\n\n```\n\n##### Create a Page\n```cs\n// Create a wiki page\nWikiPageRequestCreate createWikiModel = new WikiPageRequestCreate\n{\n    Title = \"My Wiki Page\",\n    Comment = \"This is a test page\",\n    // core types :wikitext, text, json, javascript, css\n    // For more types refer https://www.mediawiki.org/wiki/Content_handlers\n    ContentModel = \"text\",\n    Source = \"This is test wiki page content\"\n};\n\nWikiPage createdPage = await client.CreatePageAsync(createWikiModel);\n\n```\n\n##### Update a Page\n```cs\n// Update a wiki page\nWikiPageRequestUpdate updateWikiModel = new WikiPageRequestUpdate\n{\n    Comment = \"This is a test page\",\n    // core types :wikitext, text, json, javascript, css\n    // For more types refer https://www.mediawiki.org/wiki/Content_handlers\n    ContentModel = \"text\",\n    Source = \"This is updated wiki page content\",\n    Latest = new WikiPageRevision\n    {\n        Id = 100\n    }\n};\n\nWikiPage updatedPage = await client.UpdatePageAsync(\"My Wiki Page\", updateWikiModel);\n\n```\n\n##### Get File\n```cs\n// Get a file by name\nWikiFile file = await client.GetFileAsync(\"filename\");\n```\n\n##### Want to use IHttpClientFactory?\n```cs\nSharpWikiClient client= new SharpWikiClient(clientOptions, httpClientFactory);\n```\n\n##### Want to use other languages?\n\nYou can set `Language` in `SharpWikiClientOptions` and pass into SharpWikiClient to change a language\n\n```cs\nvar clientOptions = new SharpWikiClientOptions\n{\n    ApiUserAgent = \"SharpWiki.Tests\", // Write name of you app\n    Language = WikiLanguage.Spanish, // Choose wikipedia language\n    GetToken = () =\u003e\n    {\n        // Get Mediawiki token (required to create or update page only)\n        // For more details, refer: https://www.mediawiki.org/wiki/Extension:OAuth\n        return \"\";\n    }\n};\nSharpWikiClient client= new SharpWikiClient(clientOptions);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwannabebot%2Fsharpwiki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwannabebot%2Fsharpwiki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwannabebot%2Fsharpwiki/lists"}