2020-02-09 02:35:16 +00:00
|
|
|
using System;
|
2017-04-15 08:45:10 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Threading.Tasks;
|
2019-01-20 00:09:27 +00:00
|
|
|
using AngleSharp.Html.Parser;
|
2018-03-10 08:05:56 +00:00
|
|
|
using Jackett.Common.Models;
|
2020-02-09 18:08:34 +00:00
|
|
|
using Jackett.Common.Models.IndexerConfig.Bespoke;
|
2018-03-10 08:05:56 +00:00
|
|
|
using Jackett.Common.Services.Interfaces;
|
|
|
|
using Jackett.Common.Utils;
|
|
|
|
using Jackett.Common.Utils.Clients;
|
2017-10-29 06:21:18 +00:00
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using NLog;
|
2017-04-15 08:45:10 +00:00
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
namespace Jackett.Common.Indexers
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
2017-10-29 06:21:18 +00:00
|
|
|
internal class EliteTracker : BaseWebIndexer
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
2020-02-25 16:08:03 +00:00
|
|
|
private string LoginUrl => SiteLink + "takelogin.php";
|
|
|
|
private string BrowseUrl => SiteLink + "browse.php";
|
2018-06-11 04:42:21 +00:00
|
|
|
private bool TorrentHTTPSMode => configData.TorrentHTTPSMode.Value;
|
2019-12-22 21:01:32 +00:00
|
|
|
private string ReplaceMulti => configData.ReplaceMulti.Value;
|
2018-06-11 04:42:21 +00:00
|
|
|
private new ConfigurationDataEliteTracker configData
|
2019-12-22 21:01:32 +00:00
|
|
|
|
2017-01-04 11:35:49 +00:00
|
|
|
{
|
2020-02-25 16:08:03 +00:00
|
|
|
get => (ConfigurationDataEliteTracker)base.configData;
|
|
|
|
set => base.configData = value;
|
2017-04-15 08:45:10 +00:00
|
|
|
}
|
|
|
|
|
2017-11-05 09:42:03 +00:00
|
|
|
public EliteTracker(IIndexerConfigurationService configService, WebClient webClient, Logger logger, IProtectionService protectionService)
|
2017-01-04 11:35:49 +00:00
|
|
|
: base(name: "Elite-Tracker",
|
|
|
|
description: "French Torrent Tracker",
|
|
|
|
link: "https://elite-tracker.net/",
|
2019-12-22 21:01:32 +00:00
|
|
|
caps: new TorznabCapabilities(),
|
2017-07-10 20:58:44 +00:00
|
|
|
configService: configService,
|
2017-01-04 11:35:49 +00:00
|
|
|
logger: logger,
|
|
|
|
p: protectionService,
|
|
|
|
client: webClient,
|
2018-06-11 04:42:21 +00:00
|
|
|
configData: new ConfigurationDataEliteTracker()
|
2017-01-04 11:35:49 +00:00
|
|
|
)
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
2018-06-11 04:42:21 +00:00
|
|
|
Encoding = Encoding.UTF8;
|
2017-04-15 08:45:10 +00:00
|
|
|
Language = "fr-fr";
|
|
|
|
Type = "private";
|
|
|
|
|
2019-12-22 21:01:32 +00:00
|
|
|
// Clean capabilities
|
|
|
|
TorznabCaps.Categories.Clear();
|
|
|
|
|
2017-04-15 08:45:10 +00:00
|
|
|
AddCategoryMapping(27, TorznabCatType.TVAnime, "Animation/Animes");
|
|
|
|
AddCategoryMapping(63, TorznabCatType.TVAnime, "Animes DVD");
|
|
|
|
AddCategoryMapping(56, TorznabCatType.TVAnime, "Animes HD");
|
|
|
|
AddCategoryMapping(59, TorznabCatType.TVAnime, "Animes Serie");
|
2019-06-09 01:22:13 +00:00
|
|
|
AddCategoryMapping(89, TorznabCatType.TVAnime, "Animes HDLight");
|
|
|
|
AddCategoryMapping(87, TorznabCatType.TVAnime, "Animes Pack");
|
|
|
|
AddCategoryMapping(88, TorznabCatType.TVAnime, "Animes SD");
|
|
|
|
AddCategoryMapping(90, TorznabCatType.TVAnime, "Animes 3D");
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
AddCategoryMapping(3, TorznabCatType.PC0day, "APPLICATION");
|
|
|
|
AddCategoryMapping(74, TorznabCatType.PCPhoneAndroid, "ANDROID");
|
|
|
|
AddCategoryMapping(57, TorznabCatType.PCPhoneIOS, "IPHONE");
|
|
|
|
AddCategoryMapping(6, TorznabCatType.PC0day, "LINUX");
|
|
|
|
AddCategoryMapping(5, TorznabCatType.PCMac, "MAC");
|
|
|
|
AddCategoryMapping(4, TorznabCatType.PC0day, "WINDOWS");
|
|
|
|
|
|
|
|
AddCategoryMapping(38, TorznabCatType.TVDocumentary, "DOCUMENTAIRES");
|
2019-12-22 21:01:32 +00:00
|
|
|
AddCategoryMapping(97, TorznabCatType.TVDocumentary, "DOCUMENTAIRES PACK");
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
AddCategoryMapping(34, TorznabCatType.Books, "EBOOKS");
|
2019-06-09 01:22:13 +00:00
|
|
|
AddCategoryMapping(86, TorznabCatType.Books, "ABOOKS");
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
AddCategoryMapping(7, TorznabCatType.Movies, "FILMS");
|
|
|
|
AddCategoryMapping(11, TorznabCatType.MoviesDVD, "DVD");
|
|
|
|
AddCategoryMapping(10, TorznabCatType.MoviesSD, "DVD-RIP/BD-RIP");
|
|
|
|
AddCategoryMapping(53, TorznabCatType.MoviesSD, "DVD-SCREENER");
|
|
|
|
AddCategoryMapping(9, TorznabCatType.MoviesDVD, "R5");
|
|
|
|
AddCategoryMapping(8, TorznabCatType.MoviesSD, "SCREENER");
|
|
|
|
AddCategoryMapping(40, TorznabCatType.Movies, "VO");
|
|
|
|
AddCategoryMapping(39, TorznabCatType.Movies, "VOSTFR");
|
|
|
|
AddCategoryMapping(48, TorznabCatType.MoviesHD, "HD");
|
|
|
|
AddCategoryMapping(51, TorznabCatType.MoviesHD, "1080P");
|
|
|
|
AddCategoryMapping(70, TorznabCatType.Movies3D, "3D");
|
|
|
|
AddCategoryMapping(50, TorznabCatType.MoviesHD, "720P");
|
2019-06-09 01:22:13 +00:00
|
|
|
AddCategoryMapping(84, TorznabCatType.MoviesUHD, "4K");
|
2017-04-15 08:45:10 +00:00
|
|
|
AddCategoryMapping(49, TorznabCatType.MoviesBluRay, "BluRay");
|
2019-06-09 01:22:13 +00:00
|
|
|
AddCategoryMapping(78, TorznabCatType.MoviesHD, "HDLight");
|
2017-09-08 16:04:28 +00:00
|
|
|
AddCategoryMapping(85, TorznabCatType.MoviesHD, "x265");
|
2019-06-09 01:22:13 +00:00
|
|
|
AddCategoryMapping(91, TorznabCatType.Movies3D, "3D");
|
|
|
|
AddCategoryMapping(95, TorznabCatType.Movies, "VOSTFR");
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
AddCategoryMapping(15, TorznabCatType.Console, "JEUX VIDEO");
|
|
|
|
AddCategoryMapping(76, TorznabCatType.Console3DS, "3DS");
|
|
|
|
AddCategoryMapping(18, TorznabCatType.ConsoleNDS, "DS");
|
|
|
|
AddCategoryMapping(55, TorznabCatType.PCPhoneIOS, "IPHONE");
|
|
|
|
AddCategoryMapping(80, TorznabCatType.PCGames, "LINUX");
|
|
|
|
AddCategoryMapping(79, TorznabCatType.PCMac, "OSX");
|
|
|
|
AddCategoryMapping(22, TorznabCatType.PCGames, "PC");
|
|
|
|
AddCategoryMapping(66, TorznabCatType.ConsolePS3, "PS2");
|
|
|
|
AddCategoryMapping(58, TorznabCatType.ConsolePS3, "PS3");
|
|
|
|
AddCategoryMapping(81, TorznabCatType.ConsolePS4, "PS4");
|
|
|
|
AddCategoryMapping(20, TorznabCatType.ConsolePSP, "PSP");
|
|
|
|
AddCategoryMapping(75, TorznabCatType.ConsolePS3, "PSX");
|
|
|
|
AddCategoryMapping(19, TorznabCatType.ConsoleWii, "WII");
|
|
|
|
AddCategoryMapping(83, TorznabCatType.ConsoleWiiU, "WiiU");
|
|
|
|
AddCategoryMapping(16, TorznabCatType.ConsoleXbox, "XBOX");
|
|
|
|
AddCategoryMapping(82, TorznabCatType.ConsoleXboxOne, "XBOX ONE");
|
|
|
|
AddCategoryMapping(17, TorznabCatType.ConsoleXbox360, "XBOX360");
|
|
|
|
AddCategoryMapping(44, TorznabCatType.ConsoleXbox360, "XBOX360.E");
|
|
|
|
AddCategoryMapping(54, TorznabCatType.ConsoleXbox360, "XBOX360.JTAG");
|
|
|
|
AddCategoryMapping(43, TorznabCatType.ConsoleXbox360, "XBOX360.NTSC");
|
2019-06-09 01:22:13 +00:00
|
|
|
AddCategoryMapping(96, TorznabCatType.Console, "NSW");
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
AddCategoryMapping(23, TorznabCatType.Audio, "MUSIQUES");
|
|
|
|
AddCategoryMapping(26, TorznabCatType.Audio, "CLIP/CONCERT");
|
|
|
|
AddCategoryMapping(61, TorznabCatType.AudioLossless, "FLAC");
|
|
|
|
AddCategoryMapping(60, TorznabCatType.AudioMP3, "MP3");
|
|
|
|
|
|
|
|
AddCategoryMapping(30, TorznabCatType.TV, "SERIES");
|
2019-06-09 01:22:13 +00:00
|
|
|
AddCategoryMapping(73, TorznabCatType.TVSD, "Series Pack FR SD");
|
|
|
|
AddCategoryMapping(92, TorznabCatType.TVHD, "Series Pack FR HD");
|
|
|
|
AddCategoryMapping(93, TorznabCatType.TVSD, "Series Pack VOSTFR SD");
|
|
|
|
AddCategoryMapping(94, TorznabCatType.TVHD, "Series Pack VOSTFR HD");
|
|
|
|
AddCategoryMapping(31, TorznabCatType.TVSD, "Series FR SD");
|
|
|
|
AddCategoryMapping(32, TorznabCatType.TVSD, "Series VO SD");
|
|
|
|
AddCategoryMapping(33, TorznabCatType.TVSD, "Series VOSTFR SD");
|
|
|
|
AddCategoryMapping(77, TorznabCatType.TVSD, "Series DVD");
|
|
|
|
AddCategoryMapping(67, TorznabCatType.TVHD, "Series.FR HD");
|
|
|
|
AddCategoryMapping(68, TorznabCatType.TVHD, "Series VO HD");
|
|
|
|
AddCategoryMapping(69, TorznabCatType.TVHD, "Series VOSTFR HD");
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
AddCategoryMapping(47, TorznabCatType.TV, "SPECTACLES/EMISSIONS");
|
|
|
|
AddCategoryMapping(71, TorznabCatType.TV, "Emissions");
|
|
|
|
AddCategoryMapping(72, TorznabCatType.TV, "Spectacles");
|
|
|
|
|
|
|
|
AddCategoryMapping(35, TorznabCatType.TVSport, "SPORT");
|
|
|
|
AddCategoryMapping(36, TorznabCatType.TVSport, "CATCH");
|
|
|
|
AddCategoryMapping(65, TorznabCatType.TVSport, "UFC");
|
|
|
|
|
|
|
|
AddCategoryMapping(37, TorznabCatType.XXX, "XXX");
|
|
|
|
}
|
|
|
|
|
2017-06-28 05:31:38 +00:00
|
|
|
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
2017-01-04 11:35:49 +00:00
|
|
|
configData.LoadValuesFromJson(configJson);
|
|
|
|
|
|
|
|
var pairs = new Dictionary<string, string>
|
|
|
|
{
|
|
|
|
{ "username", configData.Username.Value },
|
|
|
|
{ "password", configData.Password.Value }
|
2017-04-15 08:45:10 +00:00
|
|
|
};
|
|
|
|
|
2017-11-07 15:17:07 +00:00
|
|
|
var result = await PostDataWithCookies(LoginUrl, pairs, "");
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
await ConfigureIfOK(result.Cookies, result.Cookies != null, () =>
|
|
|
|
{
|
|
|
|
var errorMessage = result.Content;
|
|
|
|
throw new ExceptionWithConfigData(errorMessage, configData);
|
|
|
|
});
|
|
|
|
|
|
|
|
return IndexerConfigurationStatus.RequiresTesting;
|
|
|
|
}
|
|
|
|
|
2017-07-03 05:15:47 +00:00
|
|
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
|
|
|
var releases = new List<ReleaseInfo>();
|
|
|
|
var searchString = query.GetQueryString();
|
|
|
|
|
|
|
|
var queryCollection = new Dictionary<string, string>();
|
|
|
|
queryCollection.Add("search_type", "t_name");
|
|
|
|
queryCollection.Add("do", "search");
|
|
|
|
queryCollection.Add("keywords", searchString);
|
|
|
|
queryCollection.Add("category", "0"); // multi cat search not supported
|
|
|
|
|
|
|
|
var results = await PostDataWithCookies(BrowseUrl, queryCollection);
|
|
|
|
if (results.IsRedirect)
|
|
|
|
{
|
|
|
|
// re-login
|
|
|
|
await ApplyConfiguration(null);
|
|
|
|
results = await PostDataWithCookies(BrowseUrl, queryCollection);
|
|
|
|
}
|
|
|
|
|
2017-01-04 11:35:49 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
var RowsSelector = "table[id='sortabletable'] > tbody > tr";
|
2017-04-15 08:45:10 +00:00
|
|
|
var SearchResultParser = new HtmlParser();
|
2019-01-20 00:09:27 +00:00
|
|
|
var SearchResultDocument = SearchResultParser.ParseDocument(results.Content);
|
2017-04-15 08:45:10 +00:00
|
|
|
var Rows = SearchResultDocument.QuerySelectorAll(RowsSelector);
|
|
|
|
var lastDate = DateTime.Now;
|
|
|
|
|
|
|
|
foreach (var Row in Rows.Skip(1))
|
|
|
|
{
|
|
|
|
var release = new ReleaseInfo();
|
|
|
|
release.MinimumRatio = 1;
|
|
|
|
release.MinimumSeedTime = 0;
|
2017-01-04 11:35:49 +00:00
|
|
|
|
2017-01-04 14:09:58 +00:00
|
|
|
var category = Row.QuerySelector("td:nth-child(1) > a");
|
2017-04-15 08:45:10 +00:00
|
|
|
var title = Row.QuerySelector("td:nth-child(2) a");
|
|
|
|
var added = Row.QuerySelector("td:nth-child(2) > div:has(span[style=\"float: right;\"])");
|
|
|
|
if (added == null) // not a torrent line
|
|
|
|
continue;
|
|
|
|
var pretime = added.QuerySelector("font.mkprettytime");
|
|
|
|
var tooltip = Row.QuerySelector("td:nth-child(2) > div.tooltip-content");
|
|
|
|
|
|
|
|
var link = Row.QuerySelector("td:nth-child(3)").QuerySelector("a");
|
|
|
|
var comments = Row.QuerySelector("td:nth-child(2)").QuerySelector("a");
|
|
|
|
var Size = Row.QuerySelector("td:nth-child(5)");
|
|
|
|
var Grabs = Row.QuerySelector("td:nth-child(6)").QuerySelector("a");
|
|
|
|
var Seeders = Row.QuerySelector("td:nth-child(7)").QuerySelector("a");
|
|
|
|
var Leechers = Row.QuerySelector("td:nth-child(8)").QuerySelector("a");
|
|
|
|
|
2019-12-22 21:01:32 +00:00
|
|
|
var categoryId = category.GetAttribute("href").Split('=')[1];
|
|
|
|
release.Category = MapTrackerCatToNewznab(categoryId);
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
release.Title = title.TextContent;
|
|
|
|
release.Category = MapTrackerCatToNewznab(categoryId);
|
|
|
|
release.Link = new Uri(link.GetAttribute("href"));
|
|
|
|
release.Comments = new Uri(comments.GetAttribute("href"));
|
|
|
|
release.Guid = release.Link;
|
|
|
|
release.Size = ReleaseInfo.GetBytes(Size.TextContent);
|
|
|
|
release.Seeders = ParseUtil.CoerceInt(Seeders.TextContent);
|
|
|
|
release.Peers = ParseUtil.CoerceInt(Leechers.TextContent) + release.Seeders;
|
|
|
|
release.Grabs = ParseUtil.CoerceLong(Grabs.TextContent);
|
|
|
|
|
2018-06-11 04:42:21 +00:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2017-04-15 08:45:10 +00:00
|
|
|
if (added.QuerySelector("img[alt^=\"TORRENT GRATUIT\"]") != null)
|
|
|
|
release.DownloadVolumeFactor = 0;
|
|
|
|
else if (added.QuerySelector("img[alt^=\"TORRENT SILVER\"]") != null)
|
|
|
|
release.DownloadVolumeFactor = 0.5;
|
|
|
|
else
|
|
|
|
release.DownloadVolumeFactor = 1;
|
|
|
|
|
|
|
|
if (added.QuerySelector("img[alt^=\"TORRENT X2\"]") != null)
|
|
|
|
release.UploadVolumeFactor = 2;
|
|
|
|
else
|
|
|
|
release.UploadVolumeFactor = 1;
|
|
|
|
|
|
|
|
if (tooltip != null)
|
|
|
|
{
|
|
|
|
var banner = tooltip.QuerySelector("img");
|
|
|
|
if (banner != null)
|
|
|
|
{
|
|
|
|
release.BannerUrl = new Uri(banner.GetAttribute("src"));
|
|
|
|
banner.Remove();
|
|
|
|
}
|
|
|
|
|
2019-01-16 20:06:53 +00:00
|
|
|
tooltip.QuerySelector("div:contains(\"Total Hits\")").Remove();
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
var longtitle = tooltip.QuerySelectorAll("div").First();
|
|
|
|
release.Title = longtitle.TextContent;
|
|
|
|
longtitle.Remove();
|
|
|
|
|
|
|
|
var desc = tooltip.TextContent.Trim();
|
|
|
|
if (!string.IsNullOrWhiteSpace(desc))
|
|
|
|
release.Description = desc;
|
|
|
|
}
|
|
|
|
|
2019-12-22 21:01:32 +00:00
|
|
|
//issue #5064 replace multi keyword
|
|
|
|
if (!string.IsNullOrEmpty(ReplaceMulti))
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
2020-02-10 22:16:19 +00:00
|
|
|
var regex = new Regex("(?i)([\\.\\- ])MULTI([\\.\\- ])");
|
2019-12-22 21:01:32 +00:00
|
|
|
release.Title = regex.Replace(release.Title, "$1" + ReplaceMulti + "$2");
|
2017-04-15 08:45:10 +00:00
|
|
|
}
|
2020-01-07 08:05:03 +00:00
|
|
|
// issue #6855 Replace VOSTFR with ENGLISH
|
|
|
|
if (configData.Vostfr.Value)
|
|
|
|
{
|
|
|
|
release.Title = release.Title.Replace("VOSTFR", "ENGLISH");
|
|
|
|
}
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
if (pretime != null)
|
|
|
|
{
|
|
|
|
if (release.Description == null)
|
|
|
|
release.Description = pretime.TextContent;
|
|
|
|
else
|
|
|
|
release.Description += "<br>\n" + pretime.TextContent;
|
|
|
|
release.PublishDate = lastDate;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-06-09 01:22:13 +00:00
|
|
|
release.PublishDate = DateTime.ParseExact(added.TextContent.Trim(), "dd-MM-yyyy HH:mm", CultureInfo.InvariantCulture);
|
2017-04-15 08:45:10 +00:00
|
|
|
lastDate = release.PublishDate;
|
|
|
|
}
|
|
|
|
|
2017-01-04 11:35:49 +00:00
|
|
|
releases.Add(release);
|
2017-04-15 08:45:10 +00:00
|
|
|
}
|
2017-01-04 11:35:49 +00:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
|
|
|
OnParseError(results.Content, ex);
|
2017-01-04 11:35:49 +00:00
|
|
|
}
|
|
|
|
|
2017-04-15 08:45:10 +00:00
|
|
|
return releases;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|