mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-02 16:52:04 +02:00
@@ -1,33 +0,0 @@
|
|||||||
using NzbDrone.Common.Exceptions;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Exceptions
|
|
||||||
{
|
|
||||||
public class MovieNotFoundException : NzbDroneException
|
|
||||||
{
|
|
||||||
public int TmdbMovieId { get; set; }
|
|
||||||
|
|
||||||
public MovieNotFoundException(int tmdbMovieId)
|
|
||||||
: base(string.Format("Movie with tmdbId {0} was not found, it may have been removed from TMDb.", tmdbMovieId))
|
|
||||||
{
|
|
||||||
TmdbMovieId = tmdbMovieId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MovieNotFoundException(string imdbId)
|
|
||||||
: base(string.Format("Movie with IMDBId {0} was not found, it may have been removed from TMDb.", imdbId))
|
|
||||||
{
|
|
||||||
TmdbMovieId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MovieNotFoundException(int tmdbMovieId, string message, params object[] args)
|
|
||||||
: base(message, args)
|
|
||||||
{
|
|
||||||
TmdbMovieId = tmdbMovieId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MovieNotFoundException(int tmdbMovieId, string message)
|
|
||||||
: base(message)
|
|
||||||
{
|
|
||||||
TmdbMovieId = tmdbMovieId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -46,6 +46,26 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
return new BakaBTParser(Settings, Capabilities.Categories);
|
return new BakaBTParser(Settings, Capabilities.Categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override async Task<byte[]> Download(Uri link)
|
||||||
|
{
|
||||||
|
var request = new HttpRequestBuilder(link.ToString())
|
||||||
|
.SetCookies(GetCookies() ?? new Dictionary<string, string>())
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var response = await _httpClient.ExecuteAsync(request, Definition);
|
||||||
|
|
||||||
|
var parser = new HtmlParser();
|
||||||
|
var dom = parser.ParseDocument(response.Content);
|
||||||
|
var downloadLink = dom.QuerySelectorAll(".download_link").First().GetAttribute("href");
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(downloadLink))
|
||||||
|
{
|
||||||
|
throw new Exception("Unable to find download link.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return await base.Download(new Uri(Settings.BaseUrl + downloadLink));
|
||||||
|
}
|
||||||
|
|
||||||
protected override async Task DoLogin()
|
protected override async Task DoLogin()
|
||||||
{
|
{
|
||||||
UpdateCookies(null, null);
|
UpdateCookies(null, null);
|
||||||
|
Reference in New Issue
Block a user