core: code cleanup. part 2 (#9909)

This commit is contained in:
Diego Heras 2020-10-19 23:19:10 +02:00 committed by GitHub
parent 1d6980c0e8
commit 8bc765eaae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 97 additions and 96 deletions

View File

@ -147,7 +147,7 @@ namespace Jackett.Common.Indexers
} }
// Getting login form to retrieve CSRF token // Getting login form to retrieve CSRF token
var myRequest = new Utils.Clients.WebRequest() var myRequest = new Utils.Clients.WebRequest
{ {
Url = LoginUrl Url = LoginUrl
}; };
@ -164,7 +164,7 @@ namespace Jackett.Common.Indexers
}; };
// Do the login // Do the login
var request = new Utils.Clients.WebRequest() var request = new Utils.Clients.WebRequest
{ {
PostData = pairs, PostData = pairs,
Referer = LoginUrl, Referer = LoginUrl,

View File

@ -103,7 +103,7 @@ namespace Jackett.Common.Indexers.Abstract
var pairs = new Dictionary<string, string> { var pairs = new Dictionary<string, string> {
{ "username", configData.Username.Value }, { "username", configData.Username.Value },
{ "password", configData.Password.Value }, { "password", configData.Password.Value },
{ "keeplogged", "1"}, { "keeplogged", "1"}
}; };
if (!string.IsNullOrWhiteSpace(cookie)) if (!string.IsNullOrWhiteSpace(cookie))

View File

@ -86,7 +86,7 @@ namespace Jackett.Common.Indexers
{ "/dorama/korea_dorama", "7" }, { "/dorama/korea_dorama", "7" },
{ "/dorama/china_dorama", "8" }, { "/dorama/china_dorama", "8" },
{ "/dorama", "9" }, { "/dorama", "9" },
{ "/anons_ongoing", "12" }, { "/anons_ongoing", "12" }
}; };
private static ICollection<string> DefaultSearchCategories => new[] { "0" }; private static ICollection<string> DefaultSearchCategories => new[] { "0" };
@ -574,7 +574,7 @@ namespace Jackett.Common.Indexers
{ "beforeafter", "after" }, { "beforeafter", "after" },
{ "sortby", "" }, { "sortby", "" },
{ "resorder", "desc" }, { "resorder", "desc" },
{ "showposts", "1" }, { "showposts", "1" }
}; };
data.AddRange(PrepareCategoriesQuery(query)); data.AddRange(PrepareCategoriesQuery(query));

View File

@ -68,7 +68,7 @@ namespace Jackett.Common.Indexers
var queryParameters = new NameValueCollection var queryParameters = new NameValueCollection
{ {
{ "search", query.SearchTerm }, { "search", query.SearchTerm },
{ "filter", "names,poster.url,code,torrents.list,season.year" }, { "filter", "names,poster.url,code,torrents.list,season.year" }
}; };
var response = await RequestWithCookiesAndRetryAsync(Configuration.ApiLink.Value + "/searchTitles?" + queryParameters.GetQueryString()); var response = await RequestWithCookiesAndRetryAsync(Configuration.ApiLink.Value + "/searchTitles?" + queryParameters.GetQueryString());
if (response.Status != HttpStatusCode.OK) if (response.Status != HttpStatusCode.OK)
@ -83,7 +83,7 @@ namespace Jackett.Common.Indexers
var queryParameters = new NameValueCollection var queryParameters = new NameValueCollection
{ {
{ "limit", "100" }, { "limit", "100" },
{ "filter", "names,poster.url,code,torrents.list,season.year" }, { "filter", "names,poster.url,code,torrents.list,season.year" }
}; };
var response = await RequestWithCookiesAndRetryAsync(Configuration.ApiLink.Value + "/getUpdates?" + queryParameters.GetQueryString()); var response = await RequestWithCookiesAndRetryAsync(Configuration.ApiLink.Value + "/getUpdates?" + queryParameters.GetQueryString());
if (response.Status != HttpStatusCode.OK) if (response.Status != HttpStatusCode.OK)

View File

@ -64,8 +64,8 @@ namespace Jackett.Common.Indexers
AddCategoryMapping(16, TorznabCatType.TVAnime, "Other"); AddCategoryMapping(16, TorznabCatType.TVAnime, "Other");
// Configure the language select option // Configure the language select option
var languageSelect = new SelectItem(new Dictionary<string, string>() var languageSelect = new SelectItem(new Dictionary<string, string>
{ {
{"1", "English"}, {"1", "English"},
{"2", "Japanese"}, {"2", "Japanese"},
{"3", "Polish"}, {"3", "Polish"},
@ -102,8 +102,8 @@ namespace Jackett.Common.Indexers
configData.AddDynamic("languageid", languageSelect); configData.AddDynamic("languageid", languageSelect);
// Configure the sort selects // Configure the sort selects
var sortBySelect = new SelectItem(new Dictionary<string, string>() var sortBySelect = new SelectItem(new Dictionary<string, string>
{ {
{"upload_timestamp", "created"}, {"upload_timestamp", "created"},
{"seeders", "seeders"}, {"seeders", "seeders"},
{"size", "size"}, {"size", "size"},
@ -112,7 +112,7 @@ namespace Jackett.Common.Indexers
{ Name = "Sort by", Value = "upload_timestamp" }; { Name = "Sort by", Value = "upload_timestamp" };
configData.AddDynamic("sortrequestedfromsite", sortBySelect); configData.AddDynamic("sortrequestedfromsite", sortBySelect);
var orderSelect = new SelectItem(new Dictionary<string, string>() var orderSelect = new SelectItem(new Dictionary<string, string>
{ {
{"desc", "Descending"}, {"desc", "Descending"},
{"asc", "Ascending"} {"asc", "Ascending"}
@ -146,7 +146,7 @@ namespace Jackett.Common.Indexers
{ "q", query.SearchTerm ?? string.Empty }, { "q", query.SearchTerm ?? string.Empty },
{ "s", GetSortBy }, { "s", GetSortBy },
{ "o", GetOrder }, { "o", GetOrder },
{ "group", "0" }, // No group { "group", "0" } // No group
}; };
// Get specified categories // Get specified categories

View File

@ -183,7 +183,7 @@ namespace Jackett.Common.Indexers
var response = await RequestWithCookiesAndRetryAsync(queryUrl); var response = await RequestWithCookiesAndRetryAsync(queryUrl);
if (!response.ContentString.StartsWith("{")) // not JSON => error if (!response.ContentString.StartsWith("{")) // not JSON => error
throw new ExceptionWithConfigData("unexcepted response (not JSON)", configData); throw new ExceptionWithConfigData("unexcepted response (not JSON)", configData);
dynamic json = JsonConvert.DeserializeObject<dynamic>(response.ContentString); var json = JsonConvert.DeserializeObject<dynamic>(response.ContentString);
// Parse // Parse
try try
@ -216,7 +216,7 @@ namespace Jackett.Common.Indexers
{ {
if (group["Synonymns"] is JArray) if (group["Synonymns"] is JArray)
{ {
List<string> allSyonyms = group["Synonymns"].ToObject<List<string>>(); var allSyonyms = group["Synonymns"].ToObject<List<string>>();
if (AddJapaneseTitle && allSyonyms.Count >= 1) if (AddJapaneseTitle && allSyonyms.Count >= 1)
synonyms.Add(allSyonyms[0]); synonyms.Add(allSyonyms[0]);
@ -226,7 +226,7 @@ namespace Jackett.Common.Indexers
synonyms.AddRange(allSyonyms[2].Split(',').Select(t => t.Trim())); synonyms.AddRange(allSyonyms[2].Split(',').Select(t => t.Trim()));
} else } else
{ {
Dictionary<int, string> allSynonyms = group["Synonymns"].ToObject<Dictionary<int, string>>(); var allSynonyms = group["Synonymns"].ToObject<Dictionary<int, string>>();
if (AddJapaneseTitle && allSynonyms.ContainsKey(0)) if (AddJapaneseTitle && allSynonyms.ContainsKey(0))
synonyms.Add(allSynonyms[0]); synonyms.Add(allSynonyms[0]);

View File

@ -121,7 +121,7 @@ namespace Jackett.Common.Indexers
}; };
searchUrl += "?" + queryCollection.GetQueryString(); searchUrl += "?" + queryCollection.GetQueryString();
var extraHeaders = new Dictionary<string, string>() var extraHeaders = new Dictionary<string, string>
{ {
{ "X-Requested-With", "XMLHttpRequest" } { "X-Requested-With", "XMLHttpRequest" }
}; };

View File

@ -132,7 +132,7 @@ namespace Jackett.Common.Indexers
Comments = uri, Comments = uri,
DownloadVolumeFactor = 0, DownloadVolumeFactor = 0,
UploadVolumeFactor = 1, UploadVolumeFactor = 1,
Category = new int[]{ TorznabCatType.TVAnime.ID }, Category = new[]{ TorznabCatType.TVAnime.ID }
}; };
foreach (var t in document.QuerySelectorAll("ul.media__tabs__nav > li > a")) foreach (var t in document.QuerySelectorAll("ul.media__tabs__nav > li > a"))
{ {

View File

@ -27,7 +27,7 @@ namespace Jackett.Common.Indexers
private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData;
public override string[] LegacySiteLinks { get; protected set; } = { public override string[] LegacySiteLinks { get; protected set; } = {
"https://tehconnection.me/", "https://tehconnection.me/"
}; };
public Anthelion(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) public Anthelion(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps)

View File

@ -111,7 +111,7 @@ namespace Jackett.Common.Indexers
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query) protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{ {
var releases = new List<ReleaseInfo>(); var releases = new List<ReleaseInfo>();
var searchStrings = new List<string>(new string[] { query.GetQueryString() }); var searchStrings = new List<string>(new[] { query.GetQueryString() });
if (string.IsNullOrEmpty(query.Episode) && (query.Season > 0)) if (string.IsNullOrEmpty(query.Episode) && (query.Season > 0))
// Tracker naming rules: If query is for a whole season, "Season #" instead of "S##". // Tracker naming rules: If query is for a whole season, "Season #" instead of "S##".
@ -163,7 +163,7 @@ namespace Jackett.Common.Indexers
release.MinimumRatio = 1; release.MinimumRatio = 1;
release.MinimumSeedTime = 172800; // 48 hours release.MinimumSeedTime = 172800; // 48 hours
var catStr = row.Children[0].FirstElementChild.GetAttribute("href").Split(new char[] { '[', ']' })[1]; var catStr = row.Children[0].FirstElementChild.GetAttribute("href").Split(new[] { '[', ']' })[1];
release.Category = MapTrackerCatToNewznab(catStr); release.Category = MapTrackerCatToNewznab(catStr);
var qDetails = row.Children[1].QuerySelector("a[title='View Torrent']"); var qDetails = row.Children[1].QuerySelector("a[title='View Torrent']");

View File

@ -180,7 +180,7 @@ namespace Jackett.Common.Indexers
private string FixYearPosition(string title, string year) private string FixYearPosition(string title, string year)
{ {
int index = title.LastIndexOf('-'); var index = title.LastIndexOf('-');
// If its a series // If its a series
if (index != -1) if (index != -1)
{ {

View File

@ -79,7 +79,7 @@ namespace Jackett.Common.Indexers
private async Task DoLogin() private async Task DoLogin()
{ {
var loginForm = await webclient.GetResultAsync(new Utils.Clients.WebRequest() var loginForm = await webclient.GetResultAsync(new Utils.Clients.WebRequest
{ {
Url = LoginUrl, Url = LoginUrl,
Type = RequestType.GET Type = RequestType.GET
@ -157,7 +157,7 @@ namespace Jackett.Common.Indexers
currentCategories = GetNextCategory(row, currentCategories); currentCategories = GetNextCategory(row, currentCategories);
var stringSeparator = new string[] { " | " }; var stringSeparator = new[] { " | " };
var titles = titleSeries.Split(stringSeparator, StringSplitOptions.RemoveEmptyEntries); var titles = titleSeries.Split(stringSeparator, StringSplitOptions.RemoveEmptyEntries);
if (titles.Count() > 1 && !AddRomajiTitle) if (titles.Count() > 1 && !AddRomajiTitle)
titles = titles.Skip(1).ToArray(); titles = titles.Skip(1).ToArray();
@ -233,7 +233,7 @@ namespace Jackett.Common.Indexers
private ICollection<int> GetNextCategory(IElement row, ICollection<int> currentCategories) private ICollection<int> GetNextCategory(IElement row, ICollection<int> currentCategories)
{ {
string nextCategoryName = GetCategoryName(row); var nextCategoryName = GetCategoryName(row);
if (nextCategoryName != null) if (nextCategoryName != null)
{ {
currentCategories = MapTrackerCatDescToNewznab(nextCategoryName); currentCategories = MapTrackerCatDescToNewznab(nextCategoryName);

View File

@ -22,7 +22,7 @@ namespace Jackett.Common.Indexers
public string SiteLink { get; protected set; } public string SiteLink { get; protected set; }
public virtual string[] LegacySiteLinks { get; protected set; } public virtual string[] LegacySiteLinks { get; protected set; }
public string DefaultSiteLink { get; protected set; } public string DefaultSiteLink { get; protected set; }
public virtual string[] AlternativeSiteLinks { get; protected set; } = new string[] { }; public virtual string[] AlternativeSiteLinks { get; protected set; } = { };
public string DisplayDescription { get; protected set; } public string DisplayDescription { get; protected set; }
public string DisplayName { get; protected set; } public string DisplayName { get; protected set; }
public string Language { get; protected set; } public string Language { get; protected set; }
@ -459,7 +459,7 @@ namespace Jackett.Common.Indexers
protected async Task<WebResult> RequestLoginAndFollowRedirect(string url, IEnumerable<KeyValuePair<string, string>> data, string cookies, bool returnCookiesFromFirstCall, string redirectUrlOverride = null, string referer = null, bool accumulateCookies = false) protected async Task<WebResult> RequestLoginAndFollowRedirect(string url, IEnumerable<KeyValuePair<string, string>> data, string cookies, bool returnCookiesFromFirstCall, string redirectUrlOverride = null, string referer = null, bool accumulateCookies = false)
{ {
var request = new WebRequest() var request = new WebRequest
{ {
Url = url, Url = url,
Type = RequestType.POST, Type = RequestType.POST,
@ -566,7 +566,7 @@ namespace Jackett.Common.Indexers
redirRequestCookies = (overrideCookies != null ? overrideCookies : ""); redirRequestCookies = (overrideCookies != null ? overrideCookies : "");
} }
// Do redirect // Do redirect
var redirectedResponse = await webclient.GetResultAsync(new WebRequest() var redirectedResponse = await webclient.GetResultAsync(new WebRequest
{ {
Url = overrideRedirectUrl ?? incomingResponse.RedirectingTo, Url = overrideRedirectUrl ?? incomingResponse.RedirectingTo,
Referer = referrer, Referer = referrer,

View File

@ -10,8 +10,8 @@ namespace Jackett.Common.Indexers
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class CGPeers : GazelleTracker public class CGPeers : GazelleTracker
{ {
public override string[] LegacySiteLinks { get; protected set; } = new string[] { public override string[] LegacySiteLinks { get; protected set; } = {
"https://www.cgpeers.com/", "https://www.cgpeers.com/"
}; };
public CGPeers(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) public CGPeers(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps)

View File

@ -37,7 +37,7 @@ namespace Jackett.Common.Indexers
set => base.configData = value; set => base.configData = value;
} }
protected readonly string[] OptionalFields = new string[] { "imdb", "rageid", "tvdbid", "banner" }; protected readonly string[] OptionalFields = { "imdb", "rageid", "tvdbid", "banner" };
private static readonly string[] _SupportedLogicFunctions = private static readonly string[] _SupportedLogicFunctions =
{ {
@ -1301,7 +1301,7 @@ namespace Jackett.Common.Indexers
var rawStr = applyGoTemplateText(Input.Value, variables, WebUtility.UrlEncode); var rawStr = applyGoTemplateText(Input.Value, variables, WebUtility.UrlEncode);
foreach (var part in rawStr.Split('&')) foreach (var part in rawStr.Split('&'))
{ {
var parts = part.Split(new char[] { '=' }, 2); var parts = part.Split(new[] { '=' }, 2);
var key = parts[0]; var key = parts[0];
if (key.Length == 0) if (key.Length == 0)
continue; continue;

View File

@ -15,8 +15,8 @@ namespace Jackett.Common.Indexers
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class DanishBits : CouchPotatoTracker public class DanishBits : CouchPotatoTracker
{ {
public override string[] LegacySiteLinks { get; protected set; } = new string[] { public override string[] LegacySiteLinks { get; protected set; } = {
"http://danishbits.org/", "http://danishbits.org/"
}; };
private new ConfigurationDataUserPasskey configData private new ConfigurationDataUserPasskey configData

View File

@ -149,7 +149,7 @@ namespace Jackett.Common.Indexers
try try
{ {
//var json = JArray.Parse(results.Content); //var json = JArray.Parse(results.Content);
dynamic json = JsonConvert.DeserializeObject<dynamic>(results.ContentString); var json = JsonConvert.DeserializeObject<dynamic>(results.ContentString);
foreach (var row in json ?? Enumerable.Empty<dynamic>()) foreach (var row in json ?? Enumerable.Empty<dynamic>())
{ {
var release = new ReleaseInfo(); var release = new ReleaseInfo();

View File

@ -70,7 +70,7 @@ namespace Jackett.Common.Indexers
Language = "es-es"; Language = "es-es";
Type = "public"; Type = "public";
var matchWords = new BoolItem() { Name = "Match words in title", Value = true }; var matchWords = new BoolItem { Name = "Match words in title", Value = true };
configData.AddDynamic("MatchWords", matchWords); configData.AddDynamic("MatchWords", matchWords);
AddCategoryMapping(DivxTotalCategories.Peliculas, TorznabCatType.MoviesSD); AddCategoryMapping(DivxTotalCategories.Peliculas, TorznabCatType.MoviesSD);
@ -313,7 +313,7 @@ namespace Jackett.Common.Indexers
Seeders = 1, Seeders = 1,
Peers = 2, Peers = 2,
DownloadVolumeFactor = 0, DownloadVolumeFactor = 0,
UploadVolumeFactor = 1, UploadVolumeFactor = 1
}; };
releases.Add(release); releases.Add(release);
} }

View File

@ -25,7 +25,7 @@ namespace Jackett.Common.Indexers
private const int MaxSearchPageLimit = 6; // 18 items per page * 6 pages = 108 private const int MaxSearchPageLimit = 6; // 18 items per page * 6 pages = 108
private readonly Dictionary<string, string> _apiHeaders = new Dictionary<string, string> private readonly Dictionary<string, string> _apiHeaders = new Dictionary<string, string>
{ {
{"X-Requested-With", "XMLHttpRequest"}, {"X-Requested-With", "XMLHttpRequest"}
}; };
private readonly Dictionary<string, string> _languages = new Dictionary<string, string> private readonly Dictionary<string, string> _languages = new Dictionary<string, string>
{ {

View File

@ -63,7 +63,7 @@ namespace Jackett.Common.Indexers.Feeds
Seeders = seeders, Seeders = seeders,
Peers = peers, Peers = peers,
InfoHash = attributes.First(e => e.Attribute("name").Value == "infohash").Attribute("value").Value, InfoHash = attributes.First(e => e.Attribute("name").Value == "infohash").Attribute("value").Value,
MagnetUri = new Uri(attributes.First(e => e.Attribute("name").Value == "magneturl").Attribute("value").Value), MagnetUri = new Uri(attributes.First(e => e.Attribute("name").Value == "magneturl").Attribute("value").Value)
}; };
return release; return release;
} }

View File

@ -22,7 +22,7 @@ namespace Jackett.Common.Indexers
"http://filelist.ro/", "http://filelist.ro/",
"https://filelist.ro/", "https://filelist.ro/",
"https://flro.org/", "https://flro.org/",
"http://flro.org/", "http://flro.org/"
}; };
private string ApiUrl => SiteLink + "api.php"; private string ApiUrl => SiteLink + "api.php";

View File

@ -70,7 +70,7 @@ namespace Jackett.Common.Indexers
var pairs = new Dictionary<string, string> { var pairs = new Dictionary<string, string> {
{ "username", configData.Username.Value }, { "username", configData.Username.Value },
{ "password", configData.Password.Value }, { "password", configData.Password.Value },
{ "login", "Login" }, { "login", "Login" }
}; };
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, null, true, null, LoginUrl); var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, null, true, null, LoginUrl);

View File

@ -276,7 +276,7 @@ namespace Jackett.Common.Indexers
{"searchseriesid", ""}, {"searchseriesid", ""},
{"tab", "listseries"}, {"tab", "listseries"},
{"function", "Search"}, {"function", "Search"},
{"string", searchTerm}, // eretz + nehedert {"string", searchTerm} // eretz + nehedert
}; };
var site = new UriBuilder var site = new UriBuilder
{ {

View File

@ -46,7 +46,7 @@ namespace Jackett.Common.Indexers
Language = "en-us"; Language = "en-us";
Type = "private"; Type = "private";
configData.AddDynamic("searchgroupnames", new BoolItem() { Name = "Search Group Names Only", Value = false }); configData.AddDynamic("searchgroupnames", new BoolItem { Name = "Search Group Names Only", Value = false });
// Apple // Apple
AddCategoryMapping("Mac", TorznabCatType.ConsoleOther, "Mac"); AddCategoryMapping("Mac", TorznabCatType.ConsoleOther, "Mac");
@ -316,7 +316,7 @@ namespace Jackett.Common.Indexers
Title = title, Title = title,
Description = qDescription?.TextContent, Description = qDescription?.TextContent,
UploadVolumeFactor = qNeutralLeech is null ? 1 : 0, UploadVolumeFactor = qNeutralLeech is null ? 1 : 0,
DownloadVolumeFactor = qFreeLeech != null || qNeutralLeech != null ? 0 : 1, DownloadVolumeFactor = qFreeLeech != null || qNeutralLeech != null ? 0 : 1
}; };
releases.Add(release); releases.Add(release);
} }

View File

@ -39,7 +39,7 @@ namespace Jackett.Common.Indexers
MovieSearchParams = new List<MovieSearchParam> MovieSearchParams = new List<MovieSearchParam>
{ {
MovieSearchParam.Q, MovieSearchParam.ImdbId MovieSearchParam.Q, MovieSearchParam.ImdbId
}, }
}, },
configService: configService, configService: configService,
client: wc, client: wc,

View File

@ -23,8 +23,8 @@ namespace Jackett.Common.Indexers
private string LoginUrl => SiteLink + "takelogin.php"; private string LoginUrl => SiteLink + "takelogin.php";
private string QueryString => "?do=search&keywords={0}&search_type=t_name&category=0&include_dead_torrents=no"; private string QueryString => "?do=search&keywords={0}&search_type=t_name&category=0&include_dead_torrents=no";
public override string[] LegacySiteLinks { get; protected set; } = new string[] { public override string[] LegacySiteLinks { get; protected set; } = {
"http://immortalseed.me/", "http://immortalseed.me/"
}; };
private new ConfigurationDataBasicLogin configData private new ConfigurationDataBasicLogin configData

View File

@ -79,12 +79,12 @@ namespace Jackett.Common.Indexers
var order = new SelectItem(new Dictionary<string, string> var order = new SelectItem(new Dictionary<string, string>
{ {
{"desc", "desc"}, {"desc", "desc"},
{"asc", "asc"}, {"asc", "asc"}
}) })
{ Name = "Order requested from site", Value = "desc" }; { Name = "Order requested from site", Value = "desc" };
configData.AddDynamic("order", order); configData.AddDynamic("order", order);
var titleOnly = new BoolItem() { Name = "Search only in title", Value = true }; var titleOnly = new BoolItem { Name = "Search only in title", Value = true };
configData.AddDynamic("titleOnly", titleOnly); configData.AddDynamic("titleOnly", titleOnly);
AddCategoryMapping("audio", TorznabCatType.Audio); AddCategoryMapping("audio", TorznabCatType.Audio);

View File

@ -27,7 +27,7 @@ namespace Jackett.Common.Indexers
private Dictionary<string, string> CategoryMappings = new Dictionary<string, string>{ private Dictionary<string, string> CategoryMappings = new Dictionary<string, string>{
{ "cats_music", "Music" }, { "cats_music", "Music" },
{ "cats_libblemixtapes", "Libble Mixtapes" }, { "cats_libblemixtapes", "Libble Mixtapes" },
{ "cats_musicvideos", "Music Videos" }, { "cats_musicvideos", "Music Videos" }
}; };
class VolumeFactorTag class VolumeFactorTag
{ {
@ -46,7 +46,7 @@ namespace Jackett.Common.Indexers
DownloadVolumeFactor = 0, DownloadVolumeFactor = 0,
UploadVolumeFactor = 1 UploadVolumeFactor = 1
} }
}, }
}; };
private new ConfigurationDataBasicLogin configData private new ConfigurationDataBasicLogin configData
@ -171,7 +171,7 @@ namespace Jackett.Common.Indexers
var albumRows = dom.QuerySelectorAll("table#torrent_table > tbody > tr:has(strong > a[href*=\"torrents.php?id=\"])"); var albumRows = dom.QuerySelectorAll("table#torrent_table > tbody > tr:has(strong > a[href*=\"torrents.php?id=\"])");
foreach (var row in albumRows) foreach (var row in albumRows)
{ {
Regex releaseGroupRegex = new Regex(@"torrents\.php\?id=([0-9]+)"); var releaseGroupRegex = new Regex(@"torrents\.php\?id=([0-9]+)");
var albumNameNode = row.QuerySelector("strong > a[href*=\"torrents.php?id=\"]"); var albumNameNode = row.QuerySelector("strong > a[href*=\"torrents.php?id=\"]");
var artistsNameNodes = row.QuerySelectorAll("strong > a[href*=\"artist.php?id=\"]"); var artistsNameNodes = row.QuerySelectorAll("strong > a[href*=\"artist.php?id=\"]");
@ -182,7 +182,7 @@ namespace Jackett.Common.Indexers
var releaseArtist = "Various Artists"; var releaseArtist = "Various Artists";
if (artistsNameNodes.Count() > 0) if (artistsNameNodes.Count() > 0)
{ {
List<string> aristNames = new List<string>(); var aristNames = new List<string>();
foreach (var aristNode in artistsNameNodes) foreach (var aristNode in artistsNameNodes)
{ {
aristNames.Add(aristNode.TextContent.Trim()); aristNames.Add(aristNode.TextContent.Trim());
@ -269,11 +269,11 @@ namespace Jackett.Common.Indexers
release.DownloadVolumeFactor = 1; release.DownloadVolumeFactor = 1;
release.UploadVolumeFactor = 1; release.UploadVolumeFactor = 1;
var releaseTags = releaseMediaType.Split('/').Select(tag => tag.Trim()).ToList(); var releaseTags = releaseMediaType.Split('/').Select(tag => tag.Trim()).ToList();
for (int i = releaseTags.Count - 1; i >= 0; i--) for (var i = releaseTags.Count - 1; i >= 0; i--)
{ {
string releaseTag = releaseTags[i]; var releaseTag = releaseTags[i];
if (VolumeTagMappings.ContainsKey(releaseTag)) { if (VolumeTagMappings.ContainsKey(releaseTag)) {
VolumeFactorTag volumeFactor = VolumeTagMappings[releaseTag]; var volumeFactor = VolumeTagMappings[releaseTag];
release.DownloadVolumeFactor = volumeFactor.DownloadVolumeFactor; release.DownloadVolumeFactor = volumeFactor.DownloadVolumeFactor;
release.UploadVolumeFactor = volumeFactor.UploadVolumeFactor; release.UploadVolumeFactor = volumeFactor.UploadVolumeFactor;
releaseTags.RemoveAt(i); releaseTags.RemoveAt(i);

View File

@ -22,8 +22,8 @@ namespace Jackett.Common.Indexers
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
internal class LostFilm : BaseWebIndexer internal class LostFilm : BaseWebIndexer
{ {
public override string[] LegacySiteLinks { get; protected set; } = new string[] { public override string[] LegacySiteLinks { get; protected set; } = {
"https://www.lostfilm.tv/", "https://www.lostfilm.tv/"
}; };
private static readonly Regex parsePlayEpisodeRegex = new Regex("PlayEpisode\\('(?<id>\\d{1,3})(?<season>\\d{3})(?<episode>\\d{3})'\\)", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex parsePlayEpisodeRegex = new Regex("PlayEpisode\\('(?<id>\\d{1,3})(?<season>\\d{3})(?<episode>\\d{3})'\\)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
@ -730,7 +730,7 @@ namespace Jackett.Common.Indexers
// Ru title: downloadLink.TextContent.Replace("\n", ""); // Ru title: downloadLink.TextContent.Replace("\n", "");
// En title should be manually constructed. // En title should be manually constructed.
var titleComponents = new string[] { var titleComponents = new[] {
serieTitle, details.GetEpisodeString(), episodeName, techInfo serieTitle, details.GetEpisodeString(), episodeName, techInfo
}; };
var downloadLink = row.QuerySelector("div.inner-box--link > a"); var downloadLink = row.QuerySelector("div.inner-box--link > a");

View File

@ -40,7 +40,7 @@ namespace Jackett.Common.Indexers
"http://www.mejortorrent.tv/", "http://www.mejortorrent.tv/",
"http://www.mejortorrentt.com/", "http://www.mejortorrentt.com/",
"https://www.mejortorrentt.org/", "https://www.mejortorrentt.org/",
"http://www.mejortorrentt.org/", "http://www.mejortorrentt.org/"
}; };
public MejorTorrent(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) public MejorTorrent(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps)

View File

@ -74,7 +74,7 @@ namespace Jackett.Common.Indexers.Meta
private static IEnumerable<string> GenerateTitleVariants(string title) private static IEnumerable<string> GenerateTitleVariants(string title)
{ {
var delimiterVariants = new char[] { '.', '_' }; var delimiterVariants = new[] { '.', '_' };
var result = new List<string>(); var result = new List<string>();
var replacedTitles = delimiterVariants.Select(c => title.Replace(' ', c)); var replacedTitles = delimiterVariants.Select(c => title.Replace(' ', c));

View File

@ -116,7 +116,7 @@ namespace Jackett.Common.Indexers
var comments = new Uri($"{SiteLink}browse/{torrent.Id}"); var comments = new Uri($"{SiteLink}browse/{torrent.Id}");
var publishDate = DateTimeUtil.FromUnknown(torrent.CreatedAt); var publishDate = DateTimeUtil.FromUnknown(torrent.CreatedAt);
var release = new ReleaseInfo() var release = new ReleaseInfo
{ {
Title = torrent.ReleaseName, Title = torrent.ReleaseName,
Link = link, Link = link,

View File

@ -23,7 +23,7 @@ namespace Jackett.Common.Indexers
public class MoreThanTV : BaseWebIndexer public class MoreThanTV : BaseWebIndexer
{ {
public override string[] LegacySiteLinks { get; protected set; } = { public override string[] LegacySiteLinks { get; protected set; } = {
"https://www.morethan.tv/", "https://www.morethan.tv/"
}; };
private string LoginUrl => SiteLink + "login.php"; private string LoginUrl => SiteLink + "login.php";

View File

@ -23,7 +23,7 @@ namespace Jackett.Common.Indexers
private enum ReleaseType private enum ReleaseType
{ {
Tv, Tv,
Movie, Movie
} }
private class NewpctRelease : ReleaseInfo private class NewpctRelease : ReleaseInfo
@ -77,7 +77,7 @@ namespace Jackett.Common.Indexers
{ {
MatchRegex = new Regex(@"window\.location\.href\s*=\s*""([^""]+)"""), MatchRegex = new Regex(@"window\.location\.href\s*=\s*""([^""]+)"""),
MatchEvaluator = m => $"https:{m.Groups[1]}" MatchEvaluator = m => $"https:{m.Groups[1]}"
}, }
}; };
private readonly int _maxDailyPages = 1; private readonly int _maxDailyPages = 1;

View File

@ -194,7 +194,7 @@ namespace Jackett.Common.Indexers
var dlLink = qDownloadLink.GetAttribute("href"); var dlLink = qDownloadLink.GetAttribute("href");
if (dlLink.Contains("javascript")) // depending on the user agent the DL link is a javascript call if (dlLink.Contains("javascript")) // depending on the user agent the DL link is a javascript call
{ {
var dlLinkParts = dlLink.Split(new char[] { '\'', ',' }); var dlLinkParts = dlLink.Split(new[] { '\'', ',' });
dlLink = SiteLink + "download/" + dlLinkParts[3] + "/" + dlLinkParts[5]; dlLink = SiteLink + "download/" + dlLinkParts[3] + "/" + dlLinkParts[5];
} }
var link = new Uri(dlLink); var link = new Uri(dlLink);

View File

@ -134,7 +134,7 @@ namespace Jackett.Common.Indexers
private async Task DoLogin() private async Task DoLogin()
{ {
// Build WebRequest for index // Build WebRequest for index
var myIndexRequest = new WebRequest() var myIndexRequest = new WebRequest
{ {
Type = RequestType.GET, Type = RequestType.GET,
Url = SiteLink, Url = SiteLink,
@ -153,7 +153,7 @@ namespace Jackett.Common.Indexers
}; };
// Build WebRequest for login // Build WebRequest for login
var myRequestLogin = new WebRequest() var myRequestLogin = new WebRequest
{ {
Type = RequestType.GET, Type = RequestType.GET,
Url = LoginUrl, Url = LoginUrl,
@ -169,7 +169,7 @@ namespace Jackett.Common.Indexers
await webclient.GetResultAsync(myRequestLogin); await webclient.GetResultAsync(myRequestLogin);
// Build WebRequest for submitting authentification // Build WebRequest for submitting authentification
var request = new WebRequest() var request = new WebRequest
{ {
PostData = pairs, PostData = pairs,
Referer = LoginUrl, Referer = LoginUrl,

View File

@ -117,7 +117,7 @@ namespace Jackett.Common.Indexers
movieListSearchUrl += "?" + queryCollection.GetQueryString(); movieListSearchUrl += "?" + queryCollection.GetQueryString();
var authHeaders = new Dictionary<string, string>() var authHeaders = new Dictionary<string, string>
{ {
{ "ApiUser", configData.User.Value }, { "ApiUser", configData.User.Value },
{ "ApiKey", configData.Key.Value } { "ApiKey", configData.Key.Value }
@ -153,7 +153,7 @@ namespace Jackett.Common.Indexers
{"action", "download"}, {"action", "download"},
{"id", torrentId}, {"id", torrentId},
{"authkey", AuthKey}, {"authkey", AuthKey},
{"torrent_pass", PassKey}, {"torrent_pass", PassKey}
}; };
var free = !(torrent["FreeleechType"] is null); var free = !(torrent["FreeleechType"] is null);

View File

@ -22,7 +22,7 @@ namespace Jackett.Common.Indexers
private static string CdnUrl => "https://cdn.pte.nu/"; private static string CdnUrl => "https://cdn.pte.nu/";
public override string[] LegacySiteLinks { get; protected set; } = { public override string[] LegacySiteLinks { get; protected set; } = {
"https://polishtracker.net/", "https://polishtracker.net/"
}; };
private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData; private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData;

View File

@ -101,7 +101,7 @@ namespace Jackett.Common.Indexers
// Prepare the search query // Prepare the search query
var queryParameters = new NameValueCollection var queryParameters = new NameValueCollection
{ {
{ "q", query.SearchTerm}, { "q", query.SearchTerm}
}; };
result = await RequestWithCookiesAndRetryAsync(SearchUrl + "?" + queryParameters.GetQueryString()); result = await RequestWithCookiesAndRetryAsync(SearchUrl + "?" + queryParameters.GetQueryString());
} }
@ -151,13 +151,14 @@ namespace Jackett.Common.Indexers
var document = await parser.ParseDocumentAsync(result.ContentString); var document = await parser.ParseDocumentAsync(result.ContentString);
var r = document.QuerySelector("div.release > div.wrapper-release"); var r = document.QuerySelector("div.release > div.wrapper-release");
var baseRelease = new ReleaseInfo(){ var baseRelease = new ReleaseInfo
{
Title = composeBaseTitle(r), Title = composeBaseTitle(r),
BannerUrl = new Uri(SiteLink + r.QuerySelector("a[data-fancybox]").Attributes["href"].Value), BannerUrl = new Uri(SiteLink + r.QuerySelector("a[data-fancybox]").Attributes["href"].Value),
Comments = uri, Comments = uri,
DownloadVolumeFactor = 0, DownloadVolumeFactor = 0,
UploadVolumeFactor = 1, UploadVolumeFactor = 1,
Category = new int[]{ TorznabCatType.TVAnime.ID }, Category = new[]{ TorznabCatType.TVAnime.ID }
}; };
foreach (var t in r.QuerySelectorAll("a[data-toggle]")) foreach (var t in r.QuerySelectorAll("a[data-toggle]"))

View File

@ -104,7 +104,7 @@ namespace Jackett.Common.Indexers
Seeders = 1, Seeders = 1,
Peers = 2, Peers = 2,
DownloadVolumeFactor = 0, DownloadVolumeFactor = 0,
UploadVolumeFactor = 1, UploadVolumeFactor = 1
}; };
releases.Add(release); releases.Add(release);
} }

View File

@ -21,9 +21,9 @@ namespace Jackett.Common.Indexers
{ {
private string SearchUrl => SiteLink + "api/v1/search"; private string SearchUrl => SiteLink + "api/v1/search";
private readonly Dictionary<string, string> APIHeaders = new Dictionary<string, string>() private readonly Dictionary<string, string> APIHeaders = new Dictionary<string, string>
{ {
{"Accept", "application/json, text/plain, */*"}, {"Accept", "application/json, text/plain, */*"}
}; };
private readonly int MAX_RESULTS_PER_PAGE = 20; private readonly int MAX_RESULTS_PER_PAGE = 20;

View File

@ -141,7 +141,7 @@ namespace Jackett.Common.Indexers
try try
{ {
//var json = JArray.Parse(results.Content); //var json = JArray.Parse(results.Content);
dynamic json = JsonConvert.DeserializeObject<dynamic>(results.ContentString); var json = JsonConvert.DeserializeObject<dynamic>(results.ContentString);
foreach (var row in json ?? Enumerable.Empty<dynamic>()) foreach (var row in json ?? Enumerable.Empty<dynamic>())
{ {
var release = new ReleaseInfo(); var release = new ReleaseInfo();

View File

@ -45,7 +45,7 @@ namespace Jackett.Common.Indexers
MovieSearchParams = new List<MovieSearchParam> MovieSearchParams = new List<MovieSearchParam>
{ {
MovieSearchParam.Q, MovieSearchParam.ImdbId MovieSearchParam.Q, MovieSearchParam.ImdbId
}, }
}, },
configService: configService, configService: configService,
client: wc, client: wc,

View File

@ -32,7 +32,7 @@ namespace Jackett.Common.Indexers
"https://tpb.skynetcloud.site/", "https://tpb.skynetcloud.site/",
"https://piratetoday.xyz/", "https://piratetoday.xyz/",
"https://piratenow.xyz/", "https://piratenow.xyz/",
"https://piratesbaycc.com/", "https://piratesbaycc.com/"
}; };
public override string[] LegacySiteLinks { get; protected set; } = { public override string[] LegacySiteLinks { get; protected set; } = {
@ -50,7 +50,7 @@ namespace Jackett.Common.Indexers
"https://piratebayztemzmv.onion.pet/", "https://piratebayztemzmv.onion.pet/",
"https://piratebayztemzmv.onion.ly/", "https://piratebayztemzmv.onion.ly/",
"https://pirateproxy.cloud/", "https://pirateproxy.cloud/",
"https://tpb18.ukpass.co/", "https://tpb18.ukpass.co/"
}; };
private const string KeyInfoHash = "{info_hash}"; private const string KeyInfoHash = "{info_hash}";

View File

@ -27,7 +27,7 @@ namespace Jackett.Common.Indexers
public override string[] LegacySiteLinks { get; protected set; } = public override string[] LegacySiteLinks { get; protected set; } =
{ {
"https://v4.torrentleech.org/", "https://v4.torrentleech.org/"
}; };
public TorrentLeech(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) public TorrentLeech(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps)

View File

@ -22,9 +22,9 @@ namespace Jackett.Common.Indexers
private string APIUrl => SiteLink + "api/"; private string APIUrl => SiteLink + "api/";
private string passkey; private string passkey;
private readonly Dictionary<string, string> APIHeaders = new Dictionary<string, string>() private readonly Dictionary<string, string> APIHeaders = new Dictionary<string, string>
{ {
{"Content-Type", "application/json"}, {"Content-Type", "application/json"}
}; };
private new ConfigurationDataBasicLoginWithRSSAndDisplay configData private new ConfigurationDataBasicLoginWithRSSAndDisplay configData
@ -59,8 +59,8 @@ namespace Jackett.Common.Indexers
Language = "de-de"; Language = "de-de";
Type = "private"; Type = "private";
configData.AddDynamic("token", new HiddenItem() { Name = "token" }); configData.AddDynamic("token", new HiddenItem { Name = "token" });
configData.AddDynamic("passkey", new HiddenItem() { Name = "passkey" }); configData.AddDynamic("passkey", new HiddenItem { Name = "passkey" });
AddCategoryMapping(24, TorznabCatType.MoviesSD, "Movies GER/SD"); AddCategoryMapping(24, TorznabCatType.MoviesSD, "Movies GER/SD");
AddCategoryMapping(18, TorznabCatType.MoviesHD, "Movies GER/720p"); AddCategoryMapping(18, TorznabCatType.MoviesHD, "Movies GER/720p");
@ -138,7 +138,7 @@ namespace Jackett.Common.Indexers
APIUrl + endpoint, method: RequestType.POST, referer: SiteLink, headers: APIHeaders, rawbody: jsonData); APIUrl + endpoint, method: RequestType.POST, referer: SiteLink, headers: APIHeaders, rawbody: jsonData);
if (!result.ContentString.StartsWith("{")) // not JSON => error if (!result.ContentString.StartsWith("{")) // not JSON => error
throw new ExceptionWithConfigData(result.ContentString, configData); throw new ExceptionWithConfigData(result.ContentString, configData);
dynamic json = JsonConvert.DeserializeObject<dynamic>(result.ContentString); var json = JsonConvert.DeserializeObject<dynamic>(result.ContentString);
return json; return json;
} }
@ -233,7 +233,7 @@ namespace Jackett.Common.Indexers
// 50 % Down // 50 % Down
1 => 0.5, 1 => 0.5,
// All others 100% down // All others 100% down
_ => 1, _ => 1
}; };
var release = new ReleaseInfo var release = new ReleaseInfo
{ {

View File

@ -81,7 +81,7 @@ namespace Jackett.Common.Indexers
Seeders = 0, Seeders = 0,
Peers = 0, Peers = 0,
DownloadVolumeFactor = 0, DownloadVolumeFactor = 0,
UploadVolumeFactor = 1, UploadVolumeFactor = 1
}); });
return releases; return releases;
} }
@ -171,7 +171,7 @@ namespace Jackett.Common.Indexers
Seeders = seeders, Seeders = seeders,
Peers = leechers + seeders, Peers = leechers + seeders,
DownloadVolumeFactor = 0, DownloadVolumeFactor = 0,
UploadVolumeFactor = 1, UploadVolumeFactor = 1
}; };
releases.Add(release); releases.Add(release);

View File

@ -26,9 +26,9 @@ namespace Jackett.Common.Indexers
{ {
private static string ApiEndpoint => "https://api.xthor.tk/"; private static string ApiEndpoint => "https://api.xthor.tk/";
public override string[] LegacySiteLinks { get; protected set; } = new string[] { public override string[] LegacySiteLinks { get; protected set; } = {
"https://xthor.bz/", "https://xthor.bz/",
"https://xthor.to", "https://xthor.to"
}; };
private string TorrentCommentUrl => TorrentDescriptionUrl; private string TorrentCommentUrl => TorrentDescriptionUrl;
@ -490,7 +490,7 @@ namespace Jackett.Common.Indexers
Output("\nQuerying tracker for results...."); Output("\nQuerying tracker for results....");
// Build WebRequest for index // Build WebRequest for index
var myIndexRequest = new WebRequest() var myIndexRequest = new WebRequest
{ {
Type = RequestType.GET, Type = RequestType.GET,
Url = request, Url = request,

View File

@ -19,10 +19,10 @@ namespace Jackett.Common.Indexers
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class YTS : BaseWebIndexer public class YTS : BaseWebIndexer
{ {
public override string[] LegacySiteLinks { get; protected set; } = new string[] { public override string[] LegacySiteLinks { get; protected set; } = {
"https://yts.ag/", "https://yts.ag/",
"https://yts.am/", "https://yts.am/",
"https://yts.lt/", "https://yts.lt/"
}; };
private string ApiEndpoint => SiteLink + "api/v2/list_movies.json"; private string ApiEndpoint => SiteLink + "api/v2/list_movies.json";