mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Add Norbits tracker (#819)
This commit is contained in:
@@ -59,6 +59,7 @@ Developer note: The software implements the [Torznab](https://github.com/Sonarr/
|
|||||||
* myAmity
|
* myAmity
|
||||||
* NCore
|
* NCore
|
||||||
* NextGen
|
* NextGen
|
||||||
|
* Norbits
|
||||||
* PassThePopcorn
|
* PassThePopcorn
|
||||||
* PirateTheNet
|
* PirateTheNet
|
||||||
* Pretome
|
* Pretome
|
||||||
|
848
src/Jackett/Indexers/Norbits.cs
Normal file
848
src/Jackett/Indexers/Norbits.cs
Normal file
@@ -0,0 +1,848 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CsQuery;
|
||||||
|
using Jackett.Models;
|
||||||
|
using Jackett.Models.IndexerConfig.Bespoke;
|
||||||
|
using Jackett.Services;
|
||||||
|
using Jackett.Utils;
|
||||||
|
using Jackett.Utils.Clients;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using NLog;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Jackett.Indexers
|
||||||
|
{
|
||||||
|
/// <summary>s
|
||||||
|
/// Provider for Norbits Private Tracker
|
||||||
|
/// </summary>
|
||||||
|
public class Norbits : BaseIndexer, IIndexer
|
||||||
|
{
|
||||||
|
private string LoginUrl => SiteLink + "login.php";
|
||||||
|
private string LoginCheckUrl => SiteLink + "takelogin.php";
|
||||||
|
private string SearchUrl => SiteLink + "browse.php";
|
||||||
|
private string TorrentCommentUrl => SiteLink + "details.php?id={id}&comonly=1#page1";
|
||||||
|
private string TorrentDescriptionUrl => SiteLink + "details.php?id={id}";
|
||||||
|
private string TorrentDownloadUrl => SiteLink + "download.php?id={id}&passkey={passkey}";
|
||||||
|
private bool Latency => ConfigData.Latency.Value;
|
||||||
|
private bool DevMode => ConfigData.DevMode.Value;
|
||||||
|
private bool CacheMode => ConfigData.HardDriveCache.Value;
|
||||||
|
private static string Directory => System.IO.Path.GetTempPath() + "Jackett\\" + MethodBase.GetCurrentMethod().DeclaringType?.Name + "\\";
|
||||||
|
|
||||||
|
private readonly Dictionary<string, string> _emulatedBrowserHeaders = new Dictionary<string, string>();
|
||||||
|
private CQ _fDom;
|
||||||
|
private ConfigurationDataNorbits ConfigData => (ConfigurationDataNorbits)configData;
|
||||||
|
|
||||||
|
public Norbits(IIndexerManagerService i, IWebClient w, Logger l, IProtectionService ps)
|
||||||
|
: base(
|
||||||
|
name: "Norbits",
|
||||||
|
description: "Norbits",
|
||||||
|
link: "https://norbits.net/",
|
||||||
|
caps: new TorznabCapabilities(),
|
||||||
|
manager: i,
|
||||||
|
client: w,
|
||||||
|
logger: l,
|
||||||
|
p: ps,
|
||||||
|
downloadBase: "https://norbits.net/download.php?id=",
|
||||||
|
configData: new ConfigurationDataNorbits())
|
||||||
|
{
|
||||||
|
Encoding = Encoding.GetEncoding("iso-8859-1");
|
||||||
|
|
||||||
|
// Clean capabilities
|
||||||
|
TorznabCaps.Categories.Clear();
|
||||||
|
|
||||||
|
// TV Series
|
||||||
|
AddCategoryMapping("main_cat[]=2&sub2_cat[]=22", TorznabCatType.TVSD);
|
||||||
|
AddCategoryMapping("main_cat[]=2&sub2_cat[]=20", TorznabCatType.TVHD);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Configure our FADN Provider
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="configJson">Our params in Json</param>
|
||||||
|
/// <returns>Configuration state</returns>
|
||||||
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
|
{
|
||||||
|
// Retrieve config values set by Jackett's user
|
||||||
|
ConfigData.LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
|
// Check & Validate Config
|
||||||
|
ValidateConfig();
|
||||||
|
|
||||||
|
// Setting our data for a better emulated browser (maximum security)
|
||||||
|
// TODO: Encoded Content not supported by Jackett at this time
|
||||||
|
// emulatedBrowserHeaders.Add("Accept-Encoding", "gzip, deflate");
|
||||||
|
|
||||||
|
// If we want to simulate a browser
|
||||||
|
if (ConfigData.Browser.Value)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Clean headers
|
||||||
|
_emulatedBrowserHeaders.Clear();
|
||||||
|
|
||||||
|
// Inject headers
|
||||||
|
_emulatedBrowserHeaders.Add("Accept", ConfigData.HeaderAccept.Value);
|
||||||
|
_emulatedBrowserHeaders.Add("Accept-Language", ConfigData.HeaderAcceptLang.Value);
|
||||||
|
_emulatedBrowserHeaders.Add("DNT", Convert.ToInt32(ConfigData.HeaderDnt.Value).ToString());
|
||||||
|
_emulatedBrowserHeaders.Add("Upgrade-Insecure-Requests", Convert.ToInt32(ConfigData.HeaderUpgradeInsecure.Value).ToString());
|
||||||
|
_emulatedBrowserHeaders.Add("User-Agent", ConfigData.HeaderUserAgent.Value);
|
||||||
|
_emulatedBrowserHeaders.Add("Referer", LoginUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
await DoLogin();
|
||||||
|
|
||||||
|
return IndexerConfigurationStatus.RequiresTesting;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Perform login to racker
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task DoLogin()
|
||||||
|
{
|
||||||
|
// Build WebRequest for index
|
||||||
|
var myIndexRequest = new WebRequest()
|
||||||
|
{
|
||||||
|
Type = RequestType.GET,
|
||||||
|
Url = SiteLink,
|
||||||
|
Headers = _emulatedBrowserHeaders,
|
||||||
|
Encoding = Encoding
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get index page for cookies
|
||||||
|
Output("\nGetting index page (for cookies).. with " + SiteLink);
|
||||||
|
var indexPage = await webclient.GetString(myIndexRequest);
|
||||||
|
|
||||||
|
// Building login form data
|
||||||
|
var pairs = new Dictionary<string, string> {
|
||||||
|
{ "username", ConfigData.Username.Value },
|
||||||
|
{ "password", ConfigData.Password.Value }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Build WebRequest for login
|
||||||
|
var myRequestLogin = new WebRequest()
|
||||||
|
{
|
||||||
|
Type = RequestType.GET,
|
||||||
|
Url = LoginUrl,
|
||||||
|
Headers = _emulatedBrowserHeaders,
|
||||||
|
Cookies = indexPage.Cookies,
|
||||||
|
Referer = SiteLink,
|
||||||
|
Encoding = Encoding
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get login page -- (not used, but simulation needed by tracker security's checks)
|
||||||
|
LatencyNow();
|
||||||
|
Output("\nGetting login page (user simulation).. with " + LoginUrl);
|
||||||
|
await webclient.GetString(myRequestLogin);
|
||||||
|
|
||||||
|
// Build WebRequest for submitting authentification
|
||||||
|
var request = new WebRequest()
|
||||||
|
{
|
||||||
|
PostData = pairs,
|
||||||
|
Referer = LoginUrl,
|
||||||
|
Type = RequestType.POST,
|
||||||
|
Url = LoginCheckUrl,
|
||||||
|
Headers = _emulatedBrowserHeaders,
|
||||||
|
Cookies = indexPage.Cookies,
|
||||||
|
Encoding = Encoding
|
||||||
|
};
|
||||||
|
|
||||||
|
// Perform loggin
|
||||||
|
LatencyNow();
|
||||||
|
Output("\nPerform loggin.. with " + LoginCheckUrl);
|
||||||
|
var response = await webclient.GetString(request);
|
||||||
|
|
||||||
|
// Test if we are logged in
|
||||||
|
await ConfigureIfOK(response.Cookies, response.Content != null && response.Cookies.Contains("uid="), () =>
|
||||||
|
{
|
||||||
|
// Default error message
|
||||||
|
var message = "Error during attempt !";
|
||||||
|
// Parse redirect header
|
||||||
|
var redirectTo = response.RedirectingTo;
|
||||||
|
|
||||||
|
// Oops, unable to login
|
||||||
|
Output("-> Login failed: " + message, "error");
|
||||||
|
throw new ExceptionWithConfigData("Login failed: " + message, configData);
|
||||||
|
});
|
||||||
|
|
||||||
|
Output("\nCookies saved for future uses...");
|
||||||
|
ConfigData.CookieHeader.Value = indexPage.Cookies + " " + response.Cookies + " ts_username=" + ConfigData.Username.Value;
|
||||||
|
|
||||||
|
Output("\n-> Login Success\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check logged-in state for provider
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task CheckLogin()
|
||||||
|
{
|
||||||
|
// Checking ...
|
||||||
|
Output("\n-> Checking logged-in state....");
|
||||||
|
var loggedInCheck = await RequestStringWithCookies(SearchUrl);
|
||||||
|
if (!loggedInCheck.Content.Contains("logout.php"))
|
||||||
|
{
|
||||||
|
// Cookie expired, renew session on provider
|
||||||
|
Output("-> Not logged, login now...\n");
|
||||||
|
|
||||||
|
await DoLogin();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Already logged, session active
|
||||||
|
Output("-> Already logged, continue...\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Execute our search query
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query">Query</param>
|
||||||
|
/// <returns>Releases</returns>
|
||||||
|
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||||
|
{
|
||||||
|
var releases = new List<ReleaseInfo>();
|
||||||
|
var torrentRowList = new List<CQ>();
|
||||||
|
var searchTerm = query.GetQueryString();
|
||||||
|
var searchUrl = SearchUrl;
|
||||||
|
|
||||||
|
// Check login before performing a query
|
||||||
|
await CheckLogin();
|
||||||
|
|
||||||
|
// Check cache first so we don't query the server (if search term used or not in dev mode)
|
||||||
|
if (!DevMode && !string.IsNullOrEmpty(searchTerm))
|
||||||
|
{
|
||||||
|
lock (cache)
|
||||||
|
{
|
||||||
|
// Remove old cache items
|
||||||
|
CleanCache();
|
||||||
|
|
||||||
|
// Search in cache
|
||||||
|
var cachedResult = cache.FirstOrDefault(i => i.Query == searchTerm);
|
||||||
|
if (cachedResult != null)
|
||||||
|
return cachedResult.Results.Select(s => (ReleaseInfo)s.Clone()).ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build our query
|
||||||
|
var request = BuildQuery(searchTerm, query, searchUrl);
|
||||||
|
|
||||||
|
// Getting results & Store content
|
||||||
|
var response = await RequestStringWithCookiesAndRetry(request, ConfigData.CookieHeader.Value);
|
||||||
|
_fDom = response.Content;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var firstPageRows = FindTorrentRows();
|
||||||
|
|
||||||
|
// Add them to torrents list
|
||||||
|
torrentRowList.AddRange(firstPageRows.Select(fRow => fRow.Cq()));
|
||||||
|
|
||||||
|
// If pagination available
|
||||||
|
int nbResults;
|
||||||
|
int pageLinkCount;
|
||||||
|
nbResults = 1;
|
||||||
|
pageLinkCount = 1;
|
||||||
|
|
||||||
|
// Check if we have a minimum of one result
|
||||||
|
if (firstPageRows.Length > 1)
|
||||||
|
{
|
||||||
|
// Retrieve total count on our alone page
|
||||||
|
nbResults = firstPageRows.Count();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check if no result
|
||||||
|
if(torrentRowList.First().Find("td").Length == 1)
|
||||||
|
{
|
||||||
|
// No results found
|
||||||
|
Output("\nNo result found for your query, please try another search term ...\n", "info");
|
||||||
|
|
||||||
|
// No result found for this query
|
||||||
|
return releases;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Output("\nFound " + nbResults + " result(s) (+/- " + firstPageRows.Length + ") in " + pageLinkCount + " page(s) for this query !");
|
||||||
|
Output("\nThere are " + firstPageRows.Length + " results on the first page !");
|
||||||
|
|
||||||
|
// Loop on results
|
||||||
|
|
||||||
|
foreach (var tRow in torrentRowList)
|
||||||
|
{
|
||||||
|
Output("Torrent #" + (releases.Count + 1));
|
||||||
|
|
||||||
|
// ID
|
||||||
|
var id = tRow.Find("td:eq(1) > a:eq(0)").Attr("href").Split('=').Last();
|
||||||
|
Output("ID: " + id);
|
||||||
|
|
||||||
|
// Release Name
|
||||||
|
var name = tRow.Find("td:eq(1) > a:eq(0)").Attr("title");
|
||||||
|
|
||||||
|
// Category
|
||||||
|
var categoryId = tRow.Find("td:eq(0) > div > a:eq(0)").Attr("href").Split('?').Last();
|
||||||
|
var categoryName = tRow.Find("td:eq(0) > div > a:eq(0)").Attr("title");
|
||||||
|
|
||||||
|
var MainCat = tRow.Find("td:eq(0) > div > a:eq(0)").Attr("href").Split('?').Last();
|
||||||
|
var SubCat1 = "none";
|
||||||
|
var SubCat2 = "none";
|
||||||
|
|
||||||
|
var testcat = MainCat;
|
||||||
|
|
||||||
|
if (tRow.Find("td:eq(0) > div > a:eq(1)").Length == 1)
|
||||||
|
{
|
||||||
|
SubCat1 = tRow.Find("td:eq(0) > div > a:eq(1)").Attr("href").Split('?').Last();
|
||||||
|
}
|
||||||
|
if (tRow.Find("td:eq(0) > div > a:eq(2)").Length == 1)
|
||||||
|
{
|
||||||
|
SubCat2 = tRow.Find("td:eq(0) > div > a:eq(2)").Attr("href").Split('?').Last();
|
||||||
|
testcat = MainCat + '&' + SubCat2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Output("Category: " + testcat + " - " + categoryName);
|
||||||
|
|
||||||
|
// Seeders
|
||||||
|
var seeders = 1;
|
||||||
|
if (tRow.Find("td:eq(10) > a").Length > 0)
|
||||||
|
{
|
||||||
|
seeders = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(9) > a").Text(), @"\d+").Value);
|
||||||
|
Output("Seeders: " + seeders);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
seeders = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(9)").Text(), @"\d+").Value);
|
||||||
|
Output("Seeders: " + seeders);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leechers
|
||||||
|
var leechers = 1;
|
||||||
|
if (tRow.Find("td:eq(10) > a").Length > 0)
|
||||||
|
{
|
||||||
|
leechers = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(10) > a").Text(), @"\d+").Value);
|
||||||
|
Output("Leechers: " + leechers);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
leechers = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(10)").Text(), @"\d+").Value);
|
||||||
|
Output("Leechers: " + leechers);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Completed
|
||||||
|
Regex regexObj = new Regex(@"[^\d]");
|
||||||
|
var completed2 = tRow.Find("td:eq(7)").Text();
|
||||||
|
var completed = regexObj.Replace(completed2, "");
|
||||||
|
Output("Completed: " + completed);
|
||||||
|
|
||||||
|
// Files
|
||||||
|
var files = 1;
|
||||||
|
if (tRow.Find("td:eq(2) > a").Length == 1)
|
||||||
|
{
|
||||||
|
files = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(2) > a").Text(), @"\d+").Value);
|
||||||
|
}
|
||||||
|
Output("Files: " + files);
|
||||||
|
|
||||||
|
// Health
|
||||||
|
var percent = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(8)").Text(), @"\d+").Value.Trim());
|
||||||
|
Output("Health: " + percent + "%");
|
||||||
|
|
||||||
|
// Size
|
||||||
|
var humanSize = tRow.Find("td:eq(6)").Text().ToLowerInvariant();
|
||||||
|
var size = ReleaseInfo.GetBytes(humanSize);
|
||||||
|
Output("Size: " + humanSize + " (" + size + " bytes)");
|
||||||
|
|
||||||
|
// --> Date
|
||||||
|
var dateTimeOrig = tRow.Find("td:eq(4)").Text();
|
||||||
|
var dateTime = Regex.Replace(dateTimeOrig, @"<[^>]+>| ", "").Trim();
|
||||||
|
var date = DateTime.ParseExact(dateTime, "yyyy-MM-ddHH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToLocalTime();
|
||||||
|
Output("Released on: " + date);
|
||||||
|
|
||||||
|
// Torrent Details URL
|
||||||
|
var detailsLink = new Uri(TorrentDescriptionUrl.Replace("{id}", id.ToString()));
|
||||||
|
Output("Details: " + detailsLink.AbsoluteUri);
|
||||||
|
|
||||||
|
// Torrent Comments URL
|
||||||
|
var commentsLink = new Uri(TorrentCommentUrl.Replace("{id}", id.ToString()));
|
||||||
|
Output("Comments Link: " + commentsLink.AbsoluteUri);
|
||||||
|
|
||||||
|
// Torrent Download URL
|
||||||
|
var passkey = tRow.Find("td:eq(1) > a:eq(1)").Attr("href");
|
||||||
|
var key = Regex.Match(passkey, "(?<=passkey\\=)([a-zA-z0-9]*)");
|
||||||
|
Uri downloadLink = new Uri(TorrentDownloadUrl.Replace("{id}", id.ToString()).Replace("{passkey}", key.ToString()));
|
||||||
|
Output("Download Link: " + downloadLink.AbsoluteUri);
|
||||||
|
|
||||||
|
// Building release infos
|
||||||
|
var release = new ReleaseInfo
|
||||||
|
{
|
||||||
|
Category = MapTrackerCatToNewznab(testcat.ToString()),
|
||||||
|
Title = name,
|
||||||
|
Seeders = seeders,
|
||||||
|
Peers = seeders + leechers,
|
||||||
|
MinimumRatio = 1,
|
||||||
|
MinimumSeedTime = 172800,
|
||||||
|
PublishDate = date,
|
||||||
|
Size = size,
|
||||||
|
Guid = detailsLink,
|
||||||
|
Comments = commentsLink,
|
||||||
|
Link = downloadLink
|
||||||
|
};
|
||||||
|
releases.Add(release);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
OnParseError("Error, unable to parse result \n" + ex.StackTrace, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return found releases
|
||||||
|
return releases;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build query to process
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="term">Term to search</param>
|
||||||
|
/// <param name="query">Torznab Query for categories mapping</param>
|
||||||
|
/// <param name="url">Search url for provider</param>
|
||||||
|
/// <param name="page">Page number to request</param>
|
||||||
|
/// <returns>URL to query for parsing and processing results</returns>
|
||||||
|
private string BuildQuery(string term, TorznabQuery query, string url, int page = 0)
|
||||||
|
{
|
||||||
|
var parameters = new NameValueCollection();
|
||||||
|
var categoriesList = MapTorznabCapsToTrackers(query);
|
||||||
|
string searchterm = term;
|
||||||
|
|
||||||
|
// Building our tracker query
|
||||||
|
parameters.Add("incldead", "0");
|
||||||
|
parameters.Add("fullsearch", "0");
|
||||||
|
parameters.Add("scenerelease", "0");
|
||||||
|
|
||||||
|
// If search term provided
|
||||||
|
if (!string.IsNullOrWhiteSpace(term))
|
||||||
|
{
|
||||||
|
searchterm = "search=" + System.Web.HttpUtility.UrlEncode(term, Encoding.GetEncoding(28591));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Showing all torrents (just for output function)
|
||||||
|
searchterm = "search=";
|
||||||
|
term = "all";
|
||||||
|
}
|
||||||
|
|
||||||
|
var CatAll = "main_cat[]=2";
|
||||||
|
|
||||||
|
var CatTest = categoriesList.Count > 0 ? string.Join(",", categoriesList) : "";
|
||||||
|
Output(CatTest);
|
||||||
|
if (CatTest == "" || CatTest == "main_cat[]=2&sub2_cat[]=22,main_cat[]=2&sub2_cat[]=20")
|
||||||
|
{
|
||||||
|
CatTest = Uri.EscapeUriString(CatAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Building our query
|
||||||
|
url += "?" + searchterm + "&" + parameters.GetQueryString() + "&" + CatTest;
|
||||||
|
|
||||||
|
Output("\nBuilded query for \"" + term + "\"... " + url);
|
||||||
|
|
||||||
|
// Return our search url
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Switch Method for Querying
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">URL created by Query Builder</param>
|
||||||
|
/// <returns>Results from query</returns>
|
||||||
|
private async Task<WebClientStringResult> QueryExec(string request)
|
||||||
|
{
|
||||||
|
WebClientStringResult results;
|
||||||
|
|
||||||
|
// Switch in we are in DEV mode with Hard Drive Cache or not
|
||||||
|
if (DevMode && CacheMode)
|
||||||
|
{
|
||||||
|
// Check Cache before querying and load previous results if available
|
||||||
|
results = await QueryCache(request);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Querying tracker directly
|
||||||
|
results = await QueryTracker(request);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Torrents Page from Cache by Query Provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">URL created by Query Builder</param>
|
||||||
|
/// <returns>Results from query</returns>
|
||||||
|
private async Task<WebClientStringResult> QueryCache(string request)
|
||||||
|
{
|
||||||
|
WebClientStringResult results;
|
||||||
|
|
||||||
|
// Create Directory if not exist
|
||||||
|
System.IO.Directory.CreateDirectory(Directory);
|
||||||
|
|
||||||
|
// Clean Storage Provider Directory from outdated cached queries
|
||||||
|
CleanCacheStorage();
|
||||||
|
|
||||||
|
// Create fingerprint for request
|
||||||
|
var file = Directory + request.GetHashCode() + ".json";
|
||||||
|
|
||||||
|
// Checking modes states
|
||||||
|
if (System.IO.File.Exists(file))
|
||||||
|
{
|
||||||
|
// File exist... loading it right now !
|
||||||
|
Output("Loading results from hard drive cache ..." + request.GetHashCode() + ".json");
|
||||||
|
results = JsonConvert.DeserializeObject<WebClientStringResult>(System.IO.File.ReadAllText(file));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No cached file found, querying tracker directly
|
||||||
|
results = await QueryTracker(request);
|
||||||
|
|
||||||
|
// Cached file didn't exist for our query, writing it right now !
|
||||||
|
Output("Writing results to hard drive cache ..." + request.GetHashCode() + ".json");
|
||||||
|
System.IO.File.WriteAllText(file, JsonConvert.SerializeObject(results));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Torrents Page from Tracker by Query Provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">URL created by Query Builder</param>
|
||||||
|
/// <returns>Results from query</returns>
|
||||||
|
private async Task<WebClientStringResult> QueryTracker(string request)
|
||||||
|
{
|
||||||
|
// Cache mode not enabled or cached file didn't exist for our query
|
||||||
|
Output("\nQuerying tracker for results....");
|
||||||
|
|
||||||
|
// Request our first page
|
||||||
|
LatencyNow();
|
||||||
|
var results = await RequestStringWithCookiesAndRetry(request, ConfigData.CookieHeader.Value, SearchUrl, _emulatedBrowserHeaders);
|
||||||
|
|
||||||
|
// Return results from tracker
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean Hard Drive Cache Storage
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="force">Force Provider Folder deletion</param>
|
||||||
|
private void CleanCacheStorage(bool force = false)
|
||||||
|
{
|
||||||
|
// Check cleaning method
|
||||||
|
if (force)
|
||||||
|
{
|
||||||
|
// Deleting Provider Storage folder and all files recursively
|
||||||
|
Output("\nDeleting Provider Storage folder and all files recursively ...");
|
||||||
|
|
||||||
|
// Check if directory exist
|
||||||
|
if (System.IO.Directory.Exists(Directory))
|
||||||
|
{
|
||||||
|
// Delete storage directory of provider
|
||||||
|
System.IO.Directory.Delete(Directory, true);
|
||||||
|
Output("-> Storage folder deleted successfully.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No directory, so nothing to do
|
||||||
|
Output("-> No Storage folder found for this provider !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var i = 0;
|
||||||
|
// Check if there is file older than ... and delete them
|
||||||
|
Output("\nCleaning Provider Storage folder... in progress.");
|
||||||
|
System.IO.Directory.GetFiles(Directory)
|
||||||
|
.Select(f => new System.IO.FileInfo(f))
|
||||||
|
.Where(f => f.LastAccessTime < DateTime.Now.AddMilliseconds(-Convert.ToInt32(ConfigData.HardDriveCacheKeepTime.Value)))
|
||||||
|
.ToList()
|
||||||
|
.ForEach(f => {
|
||||||
|
Output("Deleting cached file << " + f.Name + " >> ... done.");
|
||||||
|
f.Delete();
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Inform on what was cleaned during process
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
Output("-> Deleted " + i + " cached files during cleaning.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Output("-> Nothing deleted during cleaning.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a random fake latency to avoid detection on tracker side
|
||||||
|
/// </summary>
|
||||||
|
private void LatencyNow()
|
||||||
|
{
|
||||||
|
// Need latency ?
|
||||||
|
if (Latency)
|
||||||
|
{
|
||||||
|
var random = new Random(DateTime.Now.Millisecond);
|
||||||
|
var waiting = random.Next(Convert.ToInt32(ConfigData.LatencyStart.Value),
|
||||||
|
Convert.ToInt32(ConfigData.LatencyEnd.Value));
|
||||||
|
Output("\nLatency Faker => Sleeping for " + waiting + " ms...");
|
||||||
|
|
||||||
|
// Sleep now...
|
||||||
|
System.Threading.Thread.Sleep(waiting);
|
||||||
|
}
|
||||||
|
// Generate a random value in our range
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find torrent rows in search pages
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>JQuery Object</returns>
|
||||||
|
private CQ FindTorrentRows()
|
||||||
|
{
|
||||||
|
// Return all occurencis of torrents found
|
||||||
|
//return _fDom["#content > table > tr"];
|
||||||
|
return _fDom["# torrentTable > tbody > tr:not(:first)"];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Download torrent file from tracker
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="link">URL string</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override async Task<byte[]> Download(Uri link)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Retrieving ID from link provided
|
||||||
|
var id = ParseUtil.CoerceInt(Regex.Match(link.AbsoluteUri, @"\d+").Value);
|
||||||
|
Output("Torrent Requested ID: " + id);
|
||||||
|
|
||||||
|
// Building login form data
|
||||||
|
var pairs = new Dictionary<string, string> {
|
||||||
|
{ "torrentid", id.ToString() },
|
||||||
|
{ "_", string.Empty } // ~~ Strange, blank param...
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add emulated XHR request
|
||||||
|
_emulatedBrowserHeaders.Add("X-Prototype-Version", "1.6.0.3");
|
||||||
|
_emulatedBrowserHeaders.Add("X-Requested-With", "XMLHttpRequest");
|
||||||
|
|
||||||
|
// Get torrent file now
|
||||||
|
Output("Getting torrent file now....");
|
||||||
|
var response = await base.Download(link);
|
||||||
|
|
||||||
|
// Remove our XHR request header
|
||||||
|
_emulatedBrowserHeaders.Remove("X-Prototype-Version");
|
||||||
|
_emulatedBrowserHeaders.Remove("X-Requested-With");
|
||||||
|
|
||||||
|
// Return content
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Output message for logging or developpment (console)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">Message to output</param>
|
||||||
|
/// <param name="level">Level for Logger</param>
|
||||||
|
private void Output(string message, string level = "debug")
|
||||||
|
{
|
||||||
|
// Check if we are in dev mode
|
||||||
|
if (DevMode)
|
||||||
|
{
|
||||||
|
// Output message to console
|
||||||
|
Console.WriteLine(message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Send message to logger with level
|
||||||
|
switch (level)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
goto case "debug";
|
||||||
|
case "debug":
|
||||||
|
// Only if Debug Level Enabled on Jackett
|
||||||
|
if (Engine.Logger.IsDebugEnabled)
|
||||||
|
{
|
||||||
|
logger.Debug(message);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "info":
|
||||||
|
logger.Info(message);
|
||||||
|
break;
|
||||||
|
case "error":
|
||||||
|
logger.Error(message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate Config entered by user on Jackett
|
||||||
|
/// </summary>
|
||||||
|
private void ValidateConfig()
|
||||||
|
{
|
||||||
|
Output("\nValidating Settings ... \n");
|
||||||
|
|
||||||
|
// Check Username Setting
|
||||||
|
if (string.IsNullOrEmpty(ConfigData.Username.Value))
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("You must provide a username for this tracker to login !", ConfigData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- Username (auth) => " + ConfigData.Username.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Password Setting
|
||||||
|
if (string.IsNullOrEmpty(ConfigData.Password.Value))
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("You must provide a password with your username for this tracker to login !", ConfigData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- Password (auth) => " + ConfigData.Password.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Max Page Setting
|
||||||
|
if (!string.IsNullOrEmpty(ConfigData.Pages.Value))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- Max Pages => " + Convert.ToInt32(ConfigData.Pages.Value));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Please enter a numeric maximum number of pages to crawl !", ConfigData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Please enter a maximum number of pages to crawl !", ConfigData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Latency Setting
|
||||||
|
if (ConfigData.Latency.Value)
|
||||||
|
{
|
||||||
|
Output("\nValidated Setting -- Latency Simulation enabled");
|
||||||
|
|
||||||
|
// Check Latency Start Setting
|
||||||
|
if (!string.IsNullOrEmpty(ConfigData.LatencyStart.Value))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- Latency Start => " + Convert.ToInt32(ConfigData.LatencyStart.Value));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Please enter a numeric latency start in ms !", ConfigData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Latency Simulation enabled, Please enter a start latency !", ConfigData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Latency End Setting
|
||||||
|
if (!string.IsNullOrEmpty(ConfigData.LatencyEnd.Value))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- Latency End => " + Convert.ToInt32(ConfigData.LatencyEnd.Value));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Please enter a numeric latency end in ms !", ConfigData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Latency Simulation enabled, Please enter a end latency !", ConfigData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Browser Setting
|
||||||
|
if (ConfigData.Browser.Value)
|
||||||
|
{
|
||||||
|
Output("\nValidated Setting -- Browser Simulation enabled");
|
||||||
|
|
||||||
|
// Check ACCEPT header Setting
|
||||||
|
if (string.IsNullOrEmpty(ConfigData.HeaderAccept.Value))
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Browser Simulation enabled, Please enter an ACCEPT header !", ConfigData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- ACCEPT (header) => " + ConfigData.HeaderAccept.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check ACCEPT-LANG header Setting
|
||||||
|
if (string.IsNullOrEmpty(ConfigData.HeaderAcceptLang.Value))
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Browser Simulation enabled, Please enter an ACCEPT-LANG header !", ConfigData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- ACCEPT-LANG (header) => " + ConfigData.HeaderAcceptLang.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check USER-AGENT header Setting
|
||||||
|
if (string.IsNullOrEmpty(ConfigData.HeaderUserAgent.Value))
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Browser Simulation enabled, Please enter an USER-AGENT header !", ConfigData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- USER-AGENT (header) => " + ConfigData.HeaderUserAgent.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Browser simulation must be enabled (otherwhise, this provider will not work due to tracker's security)
|
||||||
|
throw new ExceptionWithConfigData("Browser Simulation must be enabled for this provider to work, please enable it !", ConfigData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Dev Cache Settings
|
||||||
|
if (ConfigData.HardDriveCache.Value)
|
||||||
|
{
|
||||||
|
Output("\nValidated Setting -- DEV Hard Drive Cache enabled");
|
||||||
|
|
||||||
|
// Check if Dev Mode enabled !
|
||||||
|
if (!ConfigData.DevMode.Value)
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Hard Drive is enabled but not in DEV MODE, Please enable DEV MODE !", ConfigData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Cache Keep Time Setting
|
||||||
|
if (!string.IsNullOrEmpty(ConfigData.HardDriveCacheKeepTime.Value))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Output("Validated Setting -- Cache Keep Time (ms) => " + Convert.ToInt32(ConfigData.HardDriveCacheKeepTime.Value));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Please enter a numeric hard drive keep time in ms !", ConfigData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ExceptionWithConfigData("Hard Drive Cache enabled, Please enter a maximum keep time for cache !", ConfigData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Delete cache if previously existed
|
||||||
|
CleanCacheStorage(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -166,6 +166,7 @@
|
|||||||
<Compile Include="Controllers\DownloadController.cs" />
|
<Compile Include="Controllers\DownloadController.cs" />
|
||||||
<Compile Include="Engine.cs" />
|
<Compile Include="Engine.cs" />
|
||||||
<Compile Include="Indexers\AnimeTorrents.cs" />
|
<Compile Include="Indexers\AnimeTorrents.cs" />
|
||||||
|
<Compile Include="Indexers\Norbits.cs" />
|
||||||
<Compile Include="Indexers\TVVault.cs" />
|
<Compile Include="Indexers\TVVault.cs" />
|
||||||
<Compile Include="Indexers\BJShare.cs" />
|
<Compile Include="Indexers\BJShare.cs" />
|
||||||
<Compile Include="Indexers\CardigannIndexer.cs" />
|
<Compile Include="Indexers\CardigannIndexer.cs" />
|
||||||
@@ -220,6 +221,7 @@
|
|||||||
<Compile Include="Indexers\XSpeeds.cs" />
|
<Compile Include="Indexers\XSpeeds.cs" />
|
||||||
<Compile Include="Models\GitHub\Asset.cs" />
|
<Compile Include="Models\GitHub\Asset.cs" />
|
||||||
<Compile Include="Models\GitHub\Release.cs" />
|
<Compile Include="Models\GitHub\Release.cs" />
|
||||||
|
<Compile Include="Models\IndexerConfig\Bespoke\ConfigurationDataNorbits.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\Bespoke\ConfigurationDataXthor.cs" />
|
<Compile Include="Models\IndexerConfig\Bespoke\ConfigurationDataXthor.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\Bespoke\ConfigurationDataPhxBit.cs" />
|
<Compile Include="Models\IndexerConfig\Bespoke\ConfigurationDataPhxBit.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\Bespoke\ConfigurationDataBlueTigers.cs" />
|
<Compile Include="Models\IndexerConfig\Bespoke\ConfigurationDataBlueTigers.cs" />
|
||||||
|
@@ -0,0 +1,52 @@
|
|||||||
|
namespace Jackett.Models.IndexerConfig.Bespoke
|
||||||
|
{
|
||||||
|
internal class ConfigurationDataNorbits : ConfigurationData
|
||||||
|
{
|
||||||
|
public DisplayItem CredentialsWarning { get; private set; }
|
||||||
|
public StringItem Username { get; private set; }
|
||||||
|
public StringItem Password { get; private set; }
|
||||||
|
public DisplayItem PagesWarning { get; private set; }
|
||||||
|
public StringItem Pages { get; private set; }
|
||||||
|
public DisplayItem SecurityWarning { get; private set; }
|
||||||
|
public BoolItem Latency { get; private set; }
|
||||||
|
public BoolItem Browser { get; private set; }
|
||||||
|
public DisplayItem LatencyWarning { get; private set; }
|
||||||
|
public StringItem LatencyStart { get; private set; }
|
||||||
|
public StringItem LatencyEnd { get; private set; }
|
||||||
|
public DisplayItem HeadersWarning { get; private set; }
|
||||||
|
public StringItem HeaderAccept { get; private set; }
|
||||||
|
public StringItem HeaderAcceptLang { get; private set; }
|
||||||
|
public BoolItem HeaderDnt { get; private set; }
|
||||||
|
public BoolItem HeaderUpgradeInsecure { get; private set; }
|
||||||
|
public StringItem HeaderUserAgent { get; private set; }
|
||||||
|
public DisplayItem DevWarning { get; private set; }
|
||||||
|
public BoolItem DevMode { get; private set; }
|
||||||
|
public BoolItem HardDriveCache { get; private set; }
|
||||||
|
public StringItem HardDriveCacheKeepTime { get; private set; }
|
||||||
|
|
||||||
|
public ConfigurationDataNorbits()
|
||||||
|
{
|
||||||
|
CredentialsWarning = new DisplayItem("<b>Credentials Configuration</b> (<i>Private Tracker</i>),<br /><br /> <ul><li><b>Username</b> is your account name on this tracker.</li><li><b>Password</b> is your password associated to your account name.</li></ul>") { Name = "Credentials" };
|
||||||
|
Username = new StringItem { Name = "Username (Required)", Value = "" };
|
||||||
|
Password = new StringItem { Name = "Password (Required)", Value = "" };
|
||||||
|
PagesWarning = new DisplayItem("<b>Preferences Configuration</b> (<i>Tweak your search settings</i>),<br /><br /> <ul><li><b>Max Pages to Process</b> let you specify how many page (max) Jackett can process when doing a search. Setting a value <b>higher than 4 is dangerous</b> for you account ! (<b>Result of too many requests to tracker...that <u>will be suspect</u></b>).</li></ul>") { Name = "Preferences" };
|
||||||
|
Pages = new StringItem { Name = "Max Pages to Process (Required)", Value = "4" };
|
||||||
|
SecurityWarning = new DisplayItem("<b>Security Configuration</b> (<i>Read this area carefully !</i>),<br /><br /> <ul><li><b>Latency Simulation</b> will simulate human browsing with Jacket by pausing Jacket for an random time between each request, to fake a real content browsing.</li><li><b>Browser Simulation</b> will simulate a real human browser by injecting additionals headers when doing requests to tracker.<b>You must enable it to use this provider!</b></li></ul>") { Name = "Security" };
|
||||||
|
Latency = new BoolItem() { Name = "Latency Simulation (Optional)", Value = false };
|
||||||
|
Browser = new BoolItem() { Name = "Browser Simulation (Forced)", Value = true };
|
||||||
|
LatencyWarning = new DisplayItem("<b>Latency Configuration</b> (<i>Required if latency simulation enabled</i>),<br /><br/> <ul><li>By filling this range, <b>Jackett will make a random timed pause</b> <u>between requests</u> to tracker <u>to simulate a real browser</u>.</li><li>MilliSeconds <b>only</b></li></ul>") { Name = "Simulate Latency" };
|
||||||
|
LatencyStart = new StringItem { Name = "Minimum Latency (ms)", Value = "1589" };
|
||||||
|
LatencyEnd = new StringItem { Name = "Maximum Latency (ms)", Value = "3674" };
|
||||||
|
HeadersWarning = new DisplayItem("<b>Browser Headers Configuration</b> (<i>Required if browser simulation enabled</i>),<br /><br /> <ul><li>By filling these fields, <b>Jackett will inject headers</b> with your values <u>to simulate a real browser</u>.</li><li>You can get <b>your browser values</b> here: <a href='https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending' target='blank'>www.whatismybrowser.com</a></li></ul><br /><i><b>Note that</b> some headers are not necessary because they are injected automatically by this provider such as Accept_Encoding, Connection, Host or X-Requested-With</i>") { Name = "Injecting headers" };
|
||||||
|
HeaderAccept = new StringItem { Name = "Accept", Value = "" };
|
||||||
|
HeaderAcceptLang = new StringItem { Name = "Accept-Language", Value = "" };
|
||||||
|
HeaderDnt = new BoolItem { Name = "DNT", Value = false };
|
||||||
|
HeaderUpgradeInsecure = new BoolItem { Name = "Upgrade-Insecure-Requests", Value = false };
|
||||||
|
HeaderUserAgent = new StringItem { Name = "User-Agent", Value = "" };
|
||||||
|
DevWarning = new DisplayItem("<b>Development Facility</b> (<i>For Developers ONLY</i>),<br /><br /> <ul><li>By enabling development mode, <b>Jackett will bypass his cache</b> and will <u>output debug messages to console</u> instead of his log file.</li><li>By enabling Hard Drive Cache, <b>This provider</b> will <u>save each query answers from tracker</u> in temp directory, in fact this reduce drastically HTTP requests when building a provider at parsing step for example. So, <b> Jackett will search for a cached query answer on hard drive before executing query on tracker side !</b> <i>DEV MODE must be enabled to use it !</li></ul>") { Name = "Development" };
|
||||||
|
DevMode = new BoolItem { Name = "Enable DEV MODE (Developers ONLY)", Value = false };
|
||||||
|
HardDriveCache = new BoolItem { Name = "Enable HARD DRIVE CACHE (Developers ONLY)", Value = false };
|
||||||
|
HardDriveCacheKeepTime = new StringItem { Name = "Keep Cached files for (ms)", Value = "300000" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user