Fixed: (Gazelle) Not using freeleech token correctly

Fixes #258
pull/264/head
Qstick 3 years ago
parent 4ec8ea0e4d
commit 4d129ada95

@ -11,9 +11,9 @@ namespace NzbDrone.Core.Indexers.Gazelle
{
public class GazelleParser : IParseIndexerResponse
{
private readonly GazelleSettings _settings;
private readonly IndexerCapabilities _capabilities;
private readonly string _baseUrl;
protected readonly GazelleSettings _settings;
protected readonly IndexerCapabilities _capabilities;
protected readonly string _baseUrl;
public GazelleParser(GazelleSettings settings, IndexerCapabilities capabilities, string baseUrl)
{
@ -138,11 +138,12 @@ namespace NzbDrone.Core.Indexers.Gazelle
.ToArray();
}
private string GetDownloadUrl(int torrentId)
protected virtual string GetDownloadUrl(int torrentId)
{
var url = new HttpUri(_baseUrl)
.CombinePath("/torrents.php")
.AddQueryParam("action", "download")
.AddQueryParam("useToken", _settings.UseFreeleechToken ? "1" : "0")
.AddQueryParam("id", torrentId);
return url.FullUri;

@ -17,8 +17,6 @@ namespace NzbDrone.Core.Indexers.Gazelle
public Logger Logger { get; set; }
protected virtual string APIUrl => BaseUrl + "ajax.php";
protected virtual string DownloadUrl => BaseUrl + "torrents.php?action=download&usetoken=" + (Settings.UseFreeleechToken ? "1" : "0") + "&id=";
protected virtual string DetailsUrl => BaseUrl + "torrents.php?torrentid=";
protected virtual bool ImdbInTags => false;
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Gazelle;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions
@ -49,5 +50,29 @@ namespace NzbDrone.Core.Indexers.Definitions
return caps;
}
public override IParseIndexerResponse GetParser()
{
return new OrpheusParser(Settings, Capabilities, BaseUrl);
}
}
public class OrpheusParser : GazelleParser
{
public OrpheusParser(GazelleSettings settings, IndexerCapabilities capabilities, string baseUrl)
: base(settings, capabilities, baseUrl)
{
}
protected override string GetDownloadUrl(int torrentId)
{
var url = new HttpUri(_baseUrl)
.CombinePath("/ajax.php")
.AddQueryParam("action", "download")
.AddQueryParam("useToken", _settings.UseFreeleechToken ? "1" : "0")
.AddQueryParam("id", torrentId);
return url.FullUri;
}
}
}
}

Loading…
Cancel
Save