Skip to content

WhiteCat0834/OsuNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OsuNet is a library for the Osu!API v1
Documentation for this library: link

Note

The original repository belongs to Blackcat76iT

Installation

PM> Install-Package OsuNet

Usage Example

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.
    }
}

About

osu!api v1 library

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages