TiktokExplode.Extensions.DependencyInjection 1.2.2

dotnet add package TiktokExplode.Extensions.DependencyInjection --version 1.2.2
                    
NuGet\Install-Package TiktokExplode.Extensions.DependencyInjection -Version 1.2.2
                    
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="TiktokExplode.Extensions.DependencyInjection" Version="1.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TiktokExplode.Extensions.DependencyInjection" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="TiktokExplode.Extensions.DependencyInjection" />
                    
Project file
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 TiktokExplode.Extensions.DependencyInjection --version 1.2.2
                    
#r "nuget: TiktokExplode.Extensions.DependencyInjection, 1.2.2"
                    
#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 TiktokExplode.Extensions.DependencyInjection@1.2.2
                    
#: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=TiktokExplode.Extensions.DependencyInjection&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=TiktokExplode.Extensions.DependencyInjection&version=1.2.2
                    
Install as a Cake Tool

TiktokExplode.Extensions.DependencyInjection

NuGet .NET License: MIT

Microsoft.Extensions.DependencyInjection integration for TiktokExplode.

Provides AddTiktokExplode() — a fluent extension method on IServiceCollection that registers IVideoClient and optionally ISearchClient, and lets you choose independently between the Playwright or HTTP fetcher strategy for page fetching and search.


Installation

dotnet add package TiktokExplode.Extensions.DependencyInjection

Usage

// Default — Playwright fetcher for page fetching, all defaults
services.AddTiktokExplode();

// Playwright fetcher with a visible browser window (useful for debugging)
services.AddTiktokExplode(b => b
    .UsePlaywrightFetcher(o => o.Headless = false));

// HTTP fetcher for page fetching (faster, no browser dependency)
// with Playwright search support — recommended setup
services.AddTiktokExplode(b => b
    .UseHttpFetcher()
    .UsePlaywrightSearch(o => o.BrowserChannel = "msedge"));

// HTTP fetcher only — no search support
// Note: ISearchClient is NOT registered without UsePlaywrightSearch
services.AddTiktokExplode(b => b
    .UseHttpFetcher(o => o.WarmupDelay = TimeSpan.Zero)
    .ConfigureTiktok(o => o.MaxWafRetries = 5));

Then inject IVideoClient or ISearchClient normally:

public class MyService(IVideoClient client, ISearchClient search)
{
    public async Task<string> GetTitleAsync(string url)
    {
        var video = await client.GetVideoAsync(url);
        return video.Description;
    }

    public async IAsyncEnumerable<string> SearchTitlesAsync(string keyword)
    {
        await foreach (var video in search.SearchAsync(keyword))
            yield return video.Description;
    }
}

Registered services

Service Implementation Lifetime Condition
IVideoClient TiktokClient Singleton Always
ISearchClient TiktokSearchClient Singleton UsePlaywrightSearch only
IPageFetcher PlaywrightFetcher or HttpFetcher Singleton Always
ISearchFetcher PlaywrightSearchFetcher Singleton UsePlaywrightSearch only
TiktokDownloadClient Singleton Always (shared HTTP session)
TiktokOptions Singleton Always
PlaywrightFetcherOptions or HttpFetcherOptions Singleton Always

Important: ISearchClient and ISearchFetcher are only registered when UsePlaywrightSearch is called. TikTok's search API requires a real browser to sign requests — it cannot be replicated with plain HTTP. If you omit UsePlaywrightSearch and attempt to inject ISearchClient, the DI container will throw a resolution error at runtime.

Cookie sharing: TiktokDownloadClient is registered as a singleton shared between IVideoClient and ISearchClient. Cookies obtained during a search session are automatically available when downloading, avoiding 403 Forbidden errors.


Builder API

Method Description
ConfigureTiktok(Action<TiktokOptions>?) Configures WAF retry count and base delay
UsePlaywrightFetcher(Action<PlaywrightFetcherOptions>?) Uses a real Chromium browser as IPageFetcher (default). Does not register search services
UseHttpFetcher(Action<HttpFetcherOptions>?) Uses a plain HttpClient as IPageFetcher — faster start, no browser dependency, may be WAF-blocked
UsePlaywrightSearch(Action<PlaywrightFetcherOptions>?) Registers ISearchFetcher and ISearchClient using Playwright. Independent of the page fetcher choice

Note: UsePlaywrightFetcher and UseHttpFetcher are mutually exclusive — the last one called wins. UsePlaywrightSearch is independent and can be combined with either.


Package Description
TiktokExplode Domain layer — models, interfaces, exceptions
TiktokExplode.Infrastructure HTTP + Playwright fetchers, parser, download client
TiktokExplode.All Meta-package — installs domain + infrastructure together

License

MIT — see LICENSE for details.

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.  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. 
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
1.2.2 116 6/20/2026
1.2.1 108 6/19/2026
1.1.0 107 6/12/2026
1.0.0 105 5/20/2026