Wikimedia.Library
2.1.15
dotnet add package Wikimedia.Library --version 2.1.15
NuGet\Install-Package Wikimedia.Library -Version 2.1.15
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wikimedia.Library" Version="2.1.15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wikimedia.Library" Version="2.1.15" />
<PackageReference Include="Wikimedia.Library" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Wikimedia.Library --version 2.1.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Wikimedia.Library, 2.1.15"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Wikimedia.Library@2.1.15
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Wikimedia.Library&version=2.1.15
#tool nuget:?package=Wikimedia.Library&version=2.1.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Wikimedia Library
What it does
The Wikimedia library is designed to facilitate the writing of Wikipedia command line tools and bots in the C# language.
Source code
Source code can be downloaded from https://gitlab.wikimedia.org/toolforge-repos/milhistbot-wikimedia
Getting started
Here is an example of a C# program that uses the library
using Wikimedia;
class Example
{
static void Main(string[] args)
{
Cred.Instance.Showtime("Started");
Cred.Version();
Cred.Instance.User = "your userid";
Cred.Instance.Password = "your password";
Cred.Instance.MailList = [ "your email address" ];
Cred.Instance.Showtime("Job = " + Cred.Instance.Job);
Cred.Instance.Showtime("User = " + Cred.Instance.User);
Cred.Instance.Showtime("Logs directory = " + Cred.Instance.LogsDirectory);
var page = PageFactory.GetPage ("Word count");
page.Load();
Console.WriteLine("Word count = " + page.WordsCount());
Cred.Instance.Showtime("Finished");
}
}
Credentials
- To get the example to work, first replace "your userid", "your password" and "your email address" with the real thing. They have to be valid or the library won't be able to connect to the Wikimedia server.
Building and running the example
- Then you need to build it, for which you will need a .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="wikimedia.library" Version="2.1.13" />
</ItemGroup>
</Project>
- This needs to be in the same directory as the sample.
Now you can build it with:<br/> dotnet build
And run it with:<br/> dotnet run
What it does
- The sample reads the Wikipedia article on "Word count" and counts the words in it.
- It creates a page using the PageFactory class, which returns a page of the appropriate type. You could have directly asked for the appropriate one instead i.e.
var page = new ArticlePage("Word count");
Licence
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.