2020-02-09 02:35:16 +00:00
|
|
|
using System;
|
2015-07-28 23:10:04 +00:00
|
|
|
using System.Collections.Generic;
|
2020-05-03 23:35:52 +00:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2015-07-28 23:10:04 +00:00
|
|
|
using System.Globalization;
|
|
|
|
using System.Linq;
|
2017-11-05 09:42:03 +00:00
|
|
|
using System.Net;
|
2015-07-28 23:10:04 +00:00
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
2020-02-29 18:53:04 +00:00
|
|
|
using AngleSharp.Html.Parser;
|
2018-03-10 08:05:56 +00:00
|
|
|
using Jackett.Common.Models;
|
|
|
|
using Jackett.Common.Models.IndexerConfig;
|
|
|
|
using Jackett.Common.Services.Interfaces;
|
|
|
|
using Jackett.Common.Utils;
|
2017-10-29 06:21:18 +00:00
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using NLog;
|
2015-07-28 23:10:04 +00:00
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
namespace Jackett.Common.Indexers
|
2015-07-28 23:10:04 +00:00
|
|
|
{
|
2020-05-03 23:35:52 +00:00
|
|
|
[ExcludeFromCodeCoverage]
|
2017-07-10 20:58:44 +00:00
|
|
|
public class ImmortalSeed : BaseWebIndexer
|
2015-07-28 23:10:04 +00:00
|
|
|
{
|
2020-02-25 16:08:03 +00:00
|
|
|
private string BrowsePage => SiteLink + "browse.php";
|
|
|
|
private string LoginUrl => SiteLink + "takelogin.php";
|
|
|
|
private string QueryString => "?do=search&keywords={0}&search_type=t_name&category=0&include_dead_torrents=no";
|
2015-07-28 23:10:04 +00:00
|
|
|
|
2019-03-25 05:13:14 +00:00
|
|
|
public override string[] LegacySiteLinks { get; protected set; } = new string[] {
|
|
|
|
"http://immortalseed.me/",
|
|
|
|
};
|
|
|
|
|
2017-10-29 06:21:18 +00:00
|
|
|
private new ConfigurationDataBasicLogin configData
|
2015-08-03 21:38:45 +00:00
|
|
|
{
|
2020-02-25 16:08:03 +00:00
|
|
|
get => (ConfigurationDataBasicLogin)base.configData;
|
|
|
|
set => base.configData = value;
|
2015-08-03 21:38:45 +00:00
|
|
|
}
|
|
|
|
|
2017-11-05 09:42:03 +00:00
|
|
|
public ImmortalSeed(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps)
|
2020-05-11 19:59:28 +00:00
|
|
|
: base(id: "immortalseed",
|
|
|
|
name: "ImmortalSeed",
|
|
|
|
description: "ImmortalSeed (iS) is a Private Torrent Tracker for MOVIES / TV / GENERAL",
|
|
|
|
link: "https://immortalseed.me/",
|
|
|
|
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
|
|
|
|
configService: configService,
|
|
|
|
client: wc,
|
|
|
|
logger: l,
|
|
|
|
p: ps,
|
|
|
|
configData: new ConfigurationDataBasicLogin())
|
2015-07-28 23:10:04 +00:00
|
|
|
{
|
2017-11-05 09:42:03 +00:00
|
|
|
Encoding = Encoding.UTF8;
|
2016-12-09 17:20:58 +00:00
|
|
|
Language = "en-us";
|
2017-01-27 15:57:32 +00:00
|
|
|
Type = "private";
|
2016-12-06 13:56:47 +00:00
|
|
|
|
2018-08-25 17:14:18 +00:00
|
|
|
AddCategoryMapping(3, TorznabCatType.Other, "Nuked");
|
|
|
|
AddCategoryMapping(32, TorznabCatType.TVAnime, "Anime");
|
|
|
|
AddCategoryMapping(23, TorznabCatType.PC, "Apps");
|
|
|
|
AddCategoryMapping(35, TorznabCatType.AudioAudiobook, "Audiobooks");
|
|
|
|
AddCategoryMapping(31, TorznabCatType.TV, "Childrens/Cartoons");
|
|
|
|
AddCategoryMapping(54, TorznabCatType.TVDocumentary, "Documentary - HD");
|
|
|
|
AddCategoryMapping(41, TorznabCatType.BooksComics, "Comics");
|
|
|
|
AddCategoryMapping(25, TorznabCatType.PCGames, "Games");
|
|
|
|
AddCategoryMapping(29, TorznabCatType.ConsoleXbox, "Games Xbox");
|
|
|
|
AddCategoryMapping(27, TorznabCatType.PCGames, "Games-PC Rips");
|
|
|
|
AddCategoryMapping(28, TorznabCatType.ConsolePS4, "Games-PSx");
|
|
|
|
AddCategoryMapping(49, TorznabCatType.PCPhoneOther, "Mobile");
|
2018-08-25 17:23:43 +00:00
|
|
|
AddCategoryMapping(59, TorznabCatType.MoviesUHD, "Movies-4k");
|
2018-08-25 17:14:18 +00:00
|
|
|
AddCategoryMapping(60, TorznabCatType.MoviesForeign, "Non-English 4k Movies");
|
|
|
|
AddCategoryMapping(16, TorznabCatType.MoviesHD, "Movies HD");
|
|
|
|
AddCategoryMapping(18, TorznabCatType.MoviesForeign, "Movies HD Non-English");
|
|
|
|
AddCategoryMapping(17, TorznabCatType.MoviesSD, "TS/CAM/PPV");
|
|
|
|
AddCategoryMapping(34, TorznabCatType.MoviesForeign, "Movies Low Def Non-English");
|
|
|
|
AddCategoryMapping(14, TorznabCatType.MoviesSD, "Movies-SD");
|
|
|
|
AddCategoryMapping(33, TorznabCatType.MoviesForeign, "Movies SD Non-English");
|
|
|
|
AddCategoryMapping(30, TorznabCatType.AudioOther, "Music");
|
|
|
|
AddCategoryMapping(37, TorznabCatType.AudioLossless, "FLAC");
|
|
|
|
AddCategoryMapping(36, TorznabCatType.AudioMP3, "MP3");
|
|
|
|
AddCategoryMapping(39, TorznabCatType.AudioOther, "Music Other");
|
|
|
|
AddCategoryMapping(38, TorznabCatType.AudioVideo, "Music Video");
|
|
|
|
AddCategoryMapping(45, TorznabCatType.Other, "Other");
|
|
|
|
AddCategoryMapping(7, TorznabCatType.TVSport, "Sports Tv");
|
|
|
|
AddCategoryMapping(44, TorznabCatType.TVSport, "Sports Fitness-Instructional");
|
|
|
|
AddCategoryMapping(58, TorznabCatType.TVSport, "Olympics");
|
|
|
|
AddCategoryMapping(47, TorznabCatType.TVSD, "TV - 480p");
|
|
|
|
AddCategoryMapping(8, TorznabCatType.TVHD, "TV - High Definition");
|
|
|
|
AddCategoryMapping(48, TorznabCatType.TVSD, "TV - Standard Definition - x264");
|
|
|
|
AddCategoryMapping(9, TorznabCatType.TVSD, "TV - Standard Definition - XviD");
|
|
|
|
AddCategoryMapping(4, TorznabCatType.TVHD, "TV Season Packs - HD");
|
|
|
|
AddCategoryMapping(6, TorznabCatType.TVSD, "TV Season Packs - SD");
|
2019-03-25 05:13:14 +00:00
|
|
|
AddCategoryMapping(22, TorznabCatType.BooksEbook, "Ebooks");
|
|
|
|
AddCategoryMapping(26, TorznabCatType.PCGames, "Games-PC ISO");
|
|
|
|
AddCategoryMapping(46, TorznabCatType.BooksMagazines, "Magazines");
|
|
|
|
AddCategoryMapping(50, TorznabCatType.PCPhoneIOS, "IOS");
|
|
|
|
AddCategoryMapping(51, TorznabCatType.PCPhoneAndroid, "Android");
|
|
|
|
AddCategoryMapping(52, TorznabCatType.PC0day, "Windows");
|
|
|
|
AddCategoryMapping(53, TorznabCatType.TVDocumentary, "Documentary - SD");
|
2015-07-28 23:10:04 +00:00
|
|
|
}
|
|
|
|
|
2017-06-28 05:31:38 +00:00
|
|
|
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
2015-07-28 23:10:04 +00:00
|
|
|
{
|
2017-01-02 20:39:28 +00:00
|
|
|
LoadValuesFromJson(configJson);
|
2016-11-26 16:21:50 +00:00
|
|
|
|
2015-07-28 23:10:04 +00:00
|
|
|
var pairs = new Dictionary<string, string> {
|
2015-08-03 21:38:45 +00:00
|
|
|
{ "username", configData.Username.Value },
|
|
|
|
{ "password", configData.Password.Value }
|
2015-07-28 23:10:04 +00:00
|
|
|
};
|
|
|
|
|
2016-10-25 06:49:35 +00:00
|
|
|
var response = await RequestLoginAndFollowRedirect(LoginUrl, pairs, null, true, null, LoginUrl);
|
|
|
|
|
2020-06-09 17:36:57 +00:00
|
|
|
await ConfigureIfOK(response.Cookies, response.ContentString.Contains("You have successfully logged in"), () =>
|
2015-07-28 23:10:04 +00:00
|
|
|
{
|
2020-06-09 17:36:57 +00:00
|
|
|
var errorMessage = response.ContentString;
|
2015-08-03 21:38:45 +00:00
|
|
|
throw new ExceptionWithConfigData(errorMessage, configData);
|
2015-07-28 23:10:04 +00:00
|
|
|
});
|
2015-08-22 20:57:13 +00:00
|
|
|
|
|
|
|
return IndexerConfigurationStatus.RequiresTesting;
|
2015-07-28 23:10:04 +00:00
|
|
|
}
|
|
|
|
|
2017-07-03 05:15:47 +00:00
|
|
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
2015-07-28 23:10:04 +00:00
|
|
|
{
|
|
|
|
var releases = new List<ReleaseInfo>();
|
|
|
|
var searchUrl = BrowsePage;
|
|
|
|
|
2015-08-14 21:20:51 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(query.GetQueryString()))
|
2017-11-05 09:42:03 +00:00
|
|
|
searchUrl += string.Format(QueryString, WebUtility.UrlEncode(query.GetQueryString()));
|
2015-07-28 23:10:04 +00:00
|
|
|
|
2015-07-29 17:47:51 +00:00
|
|
|
var results = await RequestStringWithCookiesAndRetry(searchUrl);
|
2015-07-28 23:10:04 +00:00
|
|
|
|
2016-11-26 16:21:50 +00:00
|
|
|
// Occasionally the cookies become invalid, login again if that happens
|
2020-06-09 17:36:57 +00:00
|
|
|
if (results.ContentString.Contains("You do not have permission to access this page."))
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
|
|
|
await ApplyConfiguration(null);
|
|
|
|
results = await RequestStringWithCookiesAndRetry(searchUrl);
|
2016-11-26 16:21:50 +00:00
|
|
|
}
|
|
|
|
|
2015-07-28 23:10:04 +00:00
|
|
|
try
|
|
|
|
{
|
2020-02-29 18:53:04 +00:00
|
|
|
var parser = new HtmlParser();
|
2020-06-09 17:36:57 +00:00
|
|
|
var dom = parser.ParseDocument(results.ContentString);
|
2015-07-28 23:10:04 +00:00
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
var rows = dom.QuerySelectorAll("#sortabletable tr:has(a[href*=\"details.php?id=\"])");
|
2018-11-13 09:28:18 +00:00
|
|
|
foreach (var row in rows)
|
2015-07-28 23:10:04 +00:00
|
|
|
{
|
|
|
|
var release = new ReleaseInfo();
|
2016-11-01 18:51:27 +00:00
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
var qDetails = row.QuerySelector("div > a[href*=\"details.php?id=\"]"); // details link, release name get's shortened if it's to long
|
|
|
|
// use Title from tooltip or fallback to Details link if there's no tooltip
|
|
|
|
var qTitle = row.QuerySelector(".tooltip-content > div:nth-of-type(1)") ?? qDetails;
|
|
|
|
release.Title = qTitle.TextContent;
|
2016-11-01 18:51:27 +00:00
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
var qDesciption = row.QuerySelectorAll(".tooltip-content > div");
|
2016-11-01 18:51:27 +00:00
|
|
|
if (qDesciption.Any())
|
2020-02-29 18:53:04 +00:00
|
|
|
release.Description = qDesciption[1].TextContent.Trim();
|
2015-07-28 23:10:04 +00:00
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
var qLink = row.QuerySelector("a[href*=\"download.php\"]");
|
|
|
|
release.Link = new Uri(qLink.GetAttribute("href"));
|
2015-07-28 23:10:04 +00:00
|
|
|
release.Guid = release.Link;
|
2020-02-29 18:53:04 +00:00
|
|
|
release.Comments = new Uri(qDetails.GetAttribute("href"));
|
2015-07-28 23:10:04 +00:00
|
|
|
|
|
|
|
// 07-22-2015 11:08 AM
|
2020-03-02 21:45:26 +00:00
|
|
|
var dateString = row.QuerySelectorAll("td:nth-of-type(2) div").Last().LastChild.TextContent.Trim();
|
2015-07-28 23:10:04 +00:00
|
|
|
release.PublishDate = DateTime.ParseExact(dateString, "MM-dd-yyyy hh:mm tt", CultureInfo.InvariantCulture);
|
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
var sizeStr = row.QuerySelector("td:nth-of-type(5)").TextContent.Trim();
|
2015-07-28 23:10:04 +00:00
|
|
|
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
release.Seeders = ParseUtil.CoerceInt(row.QuerySelector("td:nth-of-type(7)").TextContent.Trim());
|
|
|
|
release.Peers = ParseUtil.CoerceInt(row.QuerySelector("td:nth-of-type(8)").TextContent.Trim()) + release.Seeders;
|
2015-07-28 23:10:04 +00:00
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
var catLink = row.QuerySelector("td:nth-of-type(1) a").GetAttribute("href");
|
2015-07-28 23:10:04 +00:00
|
|
|
var catSplit = catLink.IndexOf("category=");
|
|
|
|
if (catSplit > -1)
|
|
|
|
catLink = catLink.Substring(catSplit + 9);
|
|
|
|
|
|
|
|
release.Category = MapTrackerCatToNewznab(catLink);
|
2016-10-27 07:35:31 +00:00
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
var grabs = row.QuerySelector("td:nth-child(6)").TextContent;
|
2016-10-27 07:35:31 +00:00
|
|
|
release.Grabs = ParseUtil.CoerceInt(grabs);
|
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
if (row.QuerySelector("img[title^=\"Free Torrent\"]") != null)
|
2017-04-15 08:45:10 +00:00
|
|
|
release.DownloadVolumeFactor = 0;
|
2020-02-29 18:53:04 +00:00
|
|
|
else if (row.QuerySelector("img[title^=\"Silver Torrent\"]") != null)
|
2017-04-15 08:45:10 +00:00
|
|
|
release.DownloadVolumeFactor = 0.5;
|
2016-10-27 07:35:31 +00:00
|
|
|
else
|
|
|
|
release.DownloadVolumeFactor = 1;
|
|
|
|
|
2019-03-25 14:27:25 +00:00
|
|
|
|
2020-02-29 18:53:04 +00:00
|
|
|
if (row.QuerySelector("img[title^=\"x2 Torrent\"]") != null)
|
2019-03-25 14:27:25 +00:00
|
|
|
release.UploadVolumeFactor = 2;
|
|
|
|
else
|
|
|
|
release.UploadVolumeFactor = 1;
|
2016-10-27 07:35:31 +00:00
|
|
|
|
2015-07-28 23:10:04 +00:00
|
|
|
releases.Add(release);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2020-06-09 17:36:57 +00:00
|
|
|
OnParseError(results.ContentString, ex);
|
2015-07-28 23:10:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return releases;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|