OsuNet is a library for the Osu!API v1
Documentation for this library: link
Note
The original repository belongs to Blackcat76iT
PM> Install-Package OsuNet
Before you can start using the library, you must obtain a token. You can also log in to your Osu account in advance.
Example:
using System;
using System.Linq;
using System.Net.Http;
using OsuNet;
using OsuNet.Models;
using OsuNet.Models.Options;
public class Program {
private static readonly OsuApi api = new OsuApi("YOUR_TOKEN", new HttpClient());
static async Task Main(string[] args) {
Console.Write("Enter BeatmapId: ");
string input = Console.ReadLine();
if (!ulong.TryParse(input, out ulong beatmapId)) {
Console.WriteLine("Error: Invalid BeatmapId. Please enter a valid positive integer.");
return;
}
Beatmap beatmap = (await api.GetBeatmapsAsync(new GetBeatmapsOptions() {
BeatmapId = beatmapId
})).FirstOrDefault();
if (beatmap is null) {
Console.WriteLine("Beatmap not found.");
return;
}
Console.WriteLine(beatmap.Title);
Console.WriteLine(beatmap.GetThumbnail()); // Returns a link to the thumbnail of the beatmap.
}
}