Elite Tracker: Add HTTPS tracker option (#3217)

* Add option for Elite Tracker (FR) for download torrent using https for tracker URL.

* change return type.
clean code.

* use the SiteLink variable instead of hard coding
This commit is contained in:
aurelien
2018-06-11 06:42:21 +02:00
committed by kaso17
parent 53f8465e67
commit 4e91761fdf
2 changed files with 26 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using AngleSharp.Parser.Html;
using Jackett.Common.Models.IndexerConfig.Bespoke;
using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig;
using Jackett.Common.Services.Interfaces;
@@ -22,10 +23,11 @@ namespace Jackett.Common.Indexers
{ get { return SiteLink + "takelogin.php"; } }
private string BrowseUrl
{ get { return SiteLink + "browse.php"; } }
private bool TorrentHTTPSMode => configData.TorrentHTTPSMode.Value;
private new ConfigurationDataBasicLogin configData
private new ConfigurationDataEliteTracker configData
{
get { return (ConfigurationDataBasicLogin)base.configData; }
get { return (ConfigurationDataEliteTracker)base.configData; }
set { base.configData = value; }
}
@@ -37,10 +39,10 @@ namespace Jackett.Common.Indexers
logger: logger,
p: protectionService,
client: webClient,
configData: new ConfigurationDataBasicLogin()
configData: new ConfigurationDataEliteTracker()
)
{
Encoding = Encoding.UTF8;
Encoding = Encoding.UTF8;
Language = "fr-fr";
Type = "private";
@@ -206,6 +208,13 @@ Encoding = Encoding.UTF8;
release.Peers = ParseUtil.CoerceInt(Leechers.TextContent) + release.Seeders;
release.Grabs = ParseUtil.CoerceLong(Grabs.TextContent);
if (TorrentHTTPSMode)
{
var linkHttps = Row.QuerySelector("td:nth-child(4)").QuerySelector("a").GetAttribute("href");
var idTorrent = ParseUtil.GetArgumentFromQueryString(linkHttps, "id");
release.Link = new Uri($"{SiteLink}download.php?id={idTorrent}&type=ssl");
}
if (added.QuerySelector("img[alt^=\"TORRENT GRATUIT\"]") != null)
release.DownloadVolumeFactor = 0;
else if (added.QuerySelector("img[alt^=\"TORRENT SILVER\"]") != null)

View File

@@ -0,0 +1,13 @@
namespace Jackett.Common.Models.IndexerConfig.Bespoke
{
class ConfigurationDataEliteTracker : ConfigurationDataBasicLogin
{
public BoolItem TorrentHTTPSMode { get; private set; }
public ConfigurationDataEliteTracker()
: base()
{
TorrentHTTPSMode = new BoolItem { Name = "Use https for tracker URL (Experimental)", Value = false };
}
}
}