Unofficial implementation of the SubSource API for .NET
You can install this package via the Package Manager Console in Visual Studio.
Install-Package MovieCollection.SubSourceGet 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);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);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);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.
- SubSource API Documentations
- SubSource Terms and Conditions
This project is licensed under the MIT License.