YouTubeSessionGenerator 1.0.1
dotnet add package YouTubeSessionGenerator --version 1.0.1
NuGet\Install-Package YouTubeSessionGenerator -Version 1.0.1
<PackageReference Include="YouTubeSessionGenerator" Version="1.0.1" />
<PackageVersion Include="YouTubeSessionGenerator" Version="1.0.1" />
<PackageReference Include="YouTubeSessionGenerator" />
paket add YouTubeSessionGenerator --version 1.0.1
#r "nuget: YouTubeSessionGenerator, 1.0.1"
#addin nuget:?package=YouTubeSessionGenerator&version=1.0.1
#tool nuget:?package=YouTubeSessionGenerator&version=1.0.1
YouTubeSessionGenerator
YouTubeSessionGenerator is a .NET library which allows you to generate valid trusted sessions for the internal YouTube API (InnerTube) including Visitor Data, Proof of Origin Tokens (PoTokens) & Rollout Tokens. Some of these parameters may be required to access certain parts of the InnerTube API.
This library is especially useful for services, automation tools, or projects that require valid authentication for YouTube communication - without the overhead of a full browser environment.
Features
- Trusted Sessions: Generate sessions that pass YouTube�s anti-bot checks - unlock access to protected endpoints
- Easy to Use: Just a few lines of code required - no need to worry about the low-level details
- Configurable: Built for .NET with flexible config & pluggable JS environment support - no browser needed
Getting Started
using YouTubeSessionGenerator;
using YouTubeSessionGenerator.Js.Environments;
using NodeEnvironment myCustomJsEnvironment = new(); // Make sure this gets dispoed!
YouTubeSessionConfig config = new()
{
JsEnvironment = myCustomJsEnvironment, // Required when generating Proof of Origin Tokens
HttpClient = myCustomHttpClient, // Optional: Provide your own HttpClient
Logger = myCustomLogger // Optional: Enable logging
};
YouTubeSessionCreator creator = new(config);
string visitorData = await creator.VisitorDataAsync();
string poToken = await creator.ProofOfOriginTokenAsync(visitorData);
string rolloutToken = await creator.RolloutTokenAsync();
To learn more, visit the full Getting Started & Configuration Guide.
How It Works
- Visitor Data: Session-level identity token
- Proof of Origin Token: BotGuard-validated, JS-signed token
- Rollout Token: Determines feature flags and experiments per session
Fore more details, see here.
Credits
This library was made possible thanks to the incredible reverse-engineering work and research by the open-source community, especially those who uncovered and shared insights into YouTube�s internal APIs.
Special thanks to the following projects and individuals:
- LuanRT/BgUtils - for their extensive description of how PoToken are generated.
- LuanRT/YouTube.js - for their detailed understanding of the InnerTube API.
- yt-dlp - for their research of when and where PoTokens are required.
- Hao Kuang - for their detailed explanation of YouTube's internal API design.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Fixed namespace/class name conflicts
- Updated NuGet packages