OpenSubtitlesSharp 1.0.1

dotnet add package OpenSubtitlesSharp --version 1.0.1                
NuGet\Install-Package OpenSubtitlesSharp -Version 1.0.1                
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="OpenSubtitlesSharp" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OpenSubtitlesSharp --version 1.0.1                
#r "nuget: OpenSubtitlesSharp, 1.0.1"                
#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 OpenSubtitlesSharp as a Cake Addin
#addin nuget:?package=OpenSubtitlesSharp&version=1.0.1

// Install OpenSubtitlesSharp as a Cake Tool
#tool nuget:?package=OpenSubtitlesSharp&version=1.0.1                

OpenSubtitlesSharp is a .NET library I developed for the Subloader application. It enables the developer to send requests to most useful OpenSubtitles API endpoints specified here.

The implemented endpoints include Login, Logout, Search(by file or query), Download, Get Languages, Get Formats and Get User Info.

Usage

Example of usage:

using var osClient = new OpenSubtitlesClient(Constants.APIKey);
var result = await osClient.GetLanguagesAsync();

The client has 2 more possible parameters for the constructors and those are the JWT token (you get it on login) and specifying whether to use the Default or VIP API Url. When you login the user there will be a bool field indicating whether that user is VIP, in that case the user can use the VIP endpoint.

For any non-OK status return from OS API, the client will throw RequestFailureException. The exception will contain the returned status code and the message from the API. These messages are generally very descriptive.

For example if you don't specify enough parameters for your search, OS API returns 406 Not Acceptable:

using var osClient = new OpenSubtitlesClient(Constants.APIKey, jwtToken);

try
{
    var searchParams = new SearchParameters
    {
        SeasonNumber = 5
    };

    var result = await osClient.SearchAsync(searchParams);
}
catch(RequestFailureException ex)
{
    Console.WriteLine($"API returned {ex.StatusCode} with message '{ex.Message}'"); // not enough parameters
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.
  • net6.0

    • No dependencies.

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.0.1 247 10/7/2023
1.0.0 124 10/7/2023