Skip to content

moviecollection/sub-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SubSource API

Unofficial implementation of the SubSource API for .NET

NuGet Version NuGet Downloads

Installation

You can install this package via the Package Manager Console in Visual Studio.

Install-Package MovieCollection.SubSource

Configuration

Get or create a new static HttpClient instance if you don't have one already.

// HttpClient lifecycle management best practices:
// https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use
private static readonly HttpClient httpClient = new HttpClient();

Then, you need to set your api key and pass it to the service's constructor.

// using MovieCollection.SubSource;

var options = new SubSourceOptions
{
    ApiKey = "your-api-key",
};

var service = new SubSourceService(httpClient, options);

Search for Movies

You can search for movies via the SearchMoviesAsync method.

var request = new NewMovieSearch
{
    Query = "The Phoenician Scheme",
    SearchType = SearchType.Text,
};

var result = await service.SearchMoviesAsync(request);

Then, you can get the movie details via the GetMovieByIdAsync method:

var result = await service.GetMovieByIdAsync(149171);

Subtitles

You can search for subtitles via the GetSubtitlesAsync method.

var request = new NewSubtitleSearch
{
    // The Phoenician Scheme
    MovieId = 149171,
    Language = "english",
};

var result = await service.GetSubtitlesAsync(request);

Then, you can get the subtitle details via the GetSubtitleByIdAsync method.

var result = await service.GetSubtitleByIdAsync(10124960);

Download a Subtitle

You can download a subtitle via the DownloadSubtitleAsync method.

Important

If the destination file already exists, it will be overwritten.

await service.DownloadSubtitleAsync(10124960, "path/to/a/file.zip");

Please see the demo project for more examples.

Official Resources

License

This project is licensed under the MIT License.

About

The SubSource API for .NET

Topics

Resources

License

Stars

Watchers

Forks

Languages