KickLib 0.1.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package KickLib --version 0.1.8                
NuGet\Install-Package KickLib -Version 0.1.8                
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="KickLib" Version="0.1.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KickLib --version 0.1.8                
#r "nuget: KickLib, 0.1.8"                
#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.
// Install KickLib as a Cake Addin
#addin nuget:?package=KickLib&version=0.1.8

// Install KickLib as a Cake Tool
#tool nuget:?package=KickLib&version=0.1.8                

<p align="center"> <img src="KickLibLogo.png" style="max-height: 300px;"> </p>

<p align="center"> <a href="https://www.microsoft.com/net"><img src="https://img.shields.io/badge/-.NET%208.0-blueviolet" style="max-height: 300px;"></a> <img src="https://img.shields.io/badge/Platform-.NET-lightgrey.svg" style="max-height: 300px;"> <a href="https://discord.gg/fPRXy57WrS"><img src="https://img.shields.io/badge/Discord-KickLib-green.svg" style="max-height: 300px;"></a> <a href="https://github.com/Bukk94/KickLib/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" style="max-height: 300px;"></a> <a href="https://www.nuget.org/packages/KickLib"><img src="https://img.shields.io/nuget/v/KickLib.svg?style=flat-square" style="max-height: 300px;"></a> </p>

<p align="center"> <a href='https://ko-fi.com/fusedchat' target='_blank'> <img height='30' style='border:0;height:38px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /> </a>

About

KickLib is a C# library that allows for interaction with unofficial / undocumented Kick API (https://kick.com) and WebSocket. KickLib eases implementation for various chatbots by providing simple to use methods.

KickLib Highlights ✨

  • Real-time chat reading
  • Stream state detection
  • Authentication flow
  • Message sending
  • API Endpoint calls

<details> <summary>Click here to see Complete Features List</summary>

Client

  • Reading Chat Messages
  • Reading Channel events
    • Follows status updated
    • Stream state detection

API

  • Categories
    • Get all main (root) categories
    • Get specific main category
    • Get top categories
    • Get sub-categories (paged)
    • Get all sub-categories (list all)
    • Get specific sub-category
    • Get subcategory clips (paged)
  • Clips
    • Get all Kick clips
    • Get clip information
    • Download clip
  • Channels
    • Get messages
    • Get channel information
    • Get channel chatroom information
    • Get channel clips
    • Get channel links
    • Get latest subscriber (Requires Authentication)
    • Get followers count
  • Emotes
    • Get channel emotes
  • Livestreams
    • Is streamer live?
    • Get livestream information
  • Message
    • Send message to chatroom (Requires Authentication)
  • Users
    • Get user information </details>

Installing ⏫

First, install NuGet. Then, install KickLib from the package manager console:

PM> Install-Package KickLib

Or from the .NET CLI as:

dotnet add package KickLib

Using KickLib via Dependency Injection

If you are using Dependency Injection, you can easily add KickLib via extension method .AddKickLib(), that will register all related services with Scoped lifetime.

Then you need to either register your own BrowserSettings or use .AddKickLibSettings().

serviceCollection
   .AddKickLib()
   .AddKickLibSettings();

Examples 💡

Using API to get information

IKickApi kickApi = new KickApi();

var userName = "channelUsername";

// Get information about user
var user = await kickApi.Users.GetUserAsync(userName);

// Get information about channel
var channelInfo = await kickApi.Channels.GetChannelInfoAsync(userName);

// Gets detailed information about current livestream
var liveInfo = await kickApi.Livestream.GetLivestreamInfoAsync(userName);

// Get clips
var channelClips = await kickApi.Clips.GetClipsAsync();

Using Cursor to page data

Using following example you can retrieve history messages from channel's chat.

IKickApi kickApi = new KickApi();
var channelInfo = await kickApi.Channels.GetChannelInfoAsync("channelUsername");
var channelId = channelInfo.Id;

KickLib.Models.Response.v2.Channels.Messages.MessagesResponse response = null;
do
{
    response = await kickApi.Channels.GetChannelMessagesAsync(90876, response?.Cursor);
    // Process page response
} while (response.Cursor != null);

To get real-time messages, use IKickClient (example below).

Using Client to read chat messages

IKickClient client = new KickClient();

client.OnMessage += delegate(object sender, ChatMessageEventArgs e)
{
    Console.WriteLine(e.Data.Content);
};

await client.ListenToChatRoomAsync(123456);
await client.ConnectAsync();

Authenticated API calls

Authenticated calls are tricky as there is no official authentication flow. Currently, authenticated API calls can be done only by enabling 2FA and providing login credentials and 2FA authorization code.

Step 1: Go to Security settings page on your account: https://kick.com/dashboard/settings/security Auth flow Step One

Step 2: Click Enable 2FA. If you already have 2FA enabled, you will need to remove it and add it again.

Auth flow Step Two

Step 3: Copy authentication code show on the screen. Usually in following format: A123BCDEFGIJFKLM. You need to save this code! You can't view it again after you finish setup.

Step 4: Finalize 2FA setup using Authentication app of your choice.

Step 5: You're done! Now you can use Authorization code in KickLib to generate correct TOTP tokens.

IKickApi kickApi = new KickApi();
var authSettings = new AuthenticationSettings("username", "password")
{
    TwoFactorAuthCode = "A123BCDEFGIJFKLM"
};
    
await kickApi.AuthenticateAsync(authSettings);
await kickApi.Messages.SendMessageAsync(123456, "My message");

Custom downloader client

If you are not satisfied with provided client, you can implement your own download logic. All you need to do is implement IApiCaller interface and pass new instance to KickApi.

public class MyOwnDownloader : IApiCaller 
{
    // Implementation
}
var myDownloader = new MyOwnDownloader();
IKickApi kickApi = new KickApi(myDownloader);

Disclaimer

Kick don't have any official API. All functionality in KickLib was researched and reversed-engineered from their website. This means that any API can change without announce.

KickLib is meant to be used for education purposes. Don't use it for heavy scraping or other harmful actions against Kick streaming platform. I don't take responsibility for any KickLib misuse and I strongly advice against such actions.

Once API is officially released, this library will be adjusted accordingly.

Special Thanks

@Robertsmania for helping with OTP generation and library improvements

License

See MIT License.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.12 114 10/6/2024
0.1.11 124 7/19/2024
0.1.10 100 7/4/2024
0.1.9 138 7/1/2024
0.1.8 144 6/9/2024
0.1.7 774 11/14/2023
0.1.6 135 11/9/2023
0.1.5 135 11/8/2023
0.1.4 185 9/25/2023
0.1.3 135 9/21/2023
0.1.2 409 7/21/2023
0.1.1 234 7/13/2023
0.1.0 155 7/13/2023
0.0.6 158 7/13/2023
0.0.5 160 7/12/2023
0.0.4 182 7/12/2023 0.0.4 is deprecated.
0.0.3 177 7/12/2023 0.0.3 is deprecated.
0.0.2 159 7/12/2023
0.0.1 161 7/11/2023

Extended KickClient, updated to .NET 8