2017-10-29 06:21:18 +00:00
|
|
|
|
using System;
|
2015-07-28 23:10:04 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
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;
|
2017-10-29 06:21:18 +00:00
|
|
|
|
using CsQuery;
|
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
|
|
|
|
{
|
2017-07-10 20:58:44 +00:00
|
|
|
|
public class ImmortalSeed : BaseWebIndexer
|
2015-07-28 23:10:04 +00:00
|
|
|
|
{
|
|
|
|
|
private string BrowsePage { get { return SiteLink + "browse.php"; } }
|
|
|
|
|
private string LoginUrl { get { return SiteLink + "takelogin.php"; } }
|
|
|
|
|
private string QueryString { get { return "?do=search&keywords={0}&search_type=t_name&category=0&include_dead_torrents=no"; } }
|
|
|
|
|
|
2017-10-29 06:21:18 +00:00
|
|
|
|
private new ConfigurationDataBasicLogin configData
|
2015-08-03 21:38:45 +00:00
|
|
|
|
{
|
|
|
|
|
get { return (ConfigurationDataBasicLogin)base.configData; }
|
|
|
|
|
set { base.configData = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-05 09:42:03 +00:00
|
|
|
|
public ImmortalSeed(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps)
|
2015-07-28 23:10:04 +00:00
|
|
|
|
: base(name: "ImmortalSeed",
|
2017-10-01 09:26:07 +00:00
|
|
|
|
description: "ImmortalSeed (iS) is a Private Torrent Tracker for MOVIES / TV / GENERAL",
|
2015-07-28 23:10:04 +00:00
|
|
|
|
link: "http://immortalseed.me/",
|
2015-08-11 18:48:25 +00:00
|
|
|
|
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
|
2017-07-10 20:58:44 +00:00
|
|
|
|
configService: configService,
|
2015-07-28 23:10:04 +00:00
|
|
|
|
client: wc,
|
2015-08-03 21:38:45 +00:00
|
|
|
|
logger: l,
|
2015-08-07 19:09:13 +00:00
|
|
|
|
p: ps,
|
2015-08-03 21:38:45 +00:00
|
|
|
|
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
|
|
|
|
|
2015-08-12 17:31:59 +00:00
|
|
|
|
AddCategoryMapping(32, TorznabCatType.TVAnime);
|
2018-02-28 14:09:21 +00:00
|
|
|
|
AddCategoryMapping(31, TorznabCatType.TVOTHER);
|
2015-07-28 23:10:04 +00:00
|
|
|
|
AddCategoryMapping(47, TorznabCatType.TVSD);
|
|
|
|
|
AddCategoryMapping(8, TorznabCatType.TVHD);
|
|
|
|
|
AddCategoryMapping(48, TorznabCatType.TVHD);
|
|
|
|
|
AddCategoryMapping(9, TorznabCatType.TVSD);
|
|
|
|
|
AddCategoryMapping(4, TorznabCatType.TVHD);
|
|
|
|
|
AddCategoryMapping(6, TorznabCatType.TVSD);
|
|
|
|
|
|
|
|
|
|
AddCategoryMapping(22, TorznabCatType.Books);
|
2015-08-12 17:31:59 +00:00
|
|
|
|
AddCategoryMapping(41, TorznabCatType.BooksComics);
|
|
|
|
|
AddCategoryMapping(23, TorznabCatType.PC);
|
2015-07-28 23:10:04 +00:00
|
|
|
|
|
|
|
|
|
AddCategoryMapping(16, TorznabCatType.MoviesHD);
|
|
|
|
|
AddCategoryMapping(17, TorznabCatType.MoviesSD);
|
|
|
|
|
AddCategoryMapping(14, TorznabCatType.MoviesSD);
|
|
|
|
|
AddCategoryMapping(34, TorznabCatType.MoviesForeign);
|
|
|
|
|
AddCategoryMapping(18, TorznabCatType.MoviesForeign);
|
|
|
|
|
AddCategoryMapping(33, TorznabCatType.MoviesForeign);
|
|
|
|
|
|
|
|
|
|
AddCategoryMapping(34, TorznabCatType.Audio);
|
|
|
|
|
AddCategoryMapping(37, TorznabCatType.AudioLossless);
|
2015-08-12 17:31:59 +00:00
|
|
|
|
AddCategoryMapping(35, TorznabCatType.AudioAudiobook);
|
|
|
|
|
AddCategoryMapping(36, TorznabCatType.AudioMP3);
|
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);
|
|
|
|
|
CQ resultDom = response.Content;
|
|
|
|
|
|
2017-04-20 11:00:24 +00:00
|
|
|
|
await ConfigureIfOK(response.Cookies, response.Content.Contains("You have successfully logged in"), () =>
|
2015-07-28 23:10:04 +00:00
|
|
|
|
{
|
2017-04-15 08:45:10 +00:00
|
|
|
|
var errorMessage = response.Content;
|
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()))
|
2015-07-28 23:10:04 +00:00
|
|
|
|
{
|
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
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (results.Content.Contains("You do not have permission to access this page."))
|
|
|
|
|
{
|
|
|
|
|
await ApplyConfiguration(null);
|
|
|
|
|
results = await RequestStringWithCookiesAndRetry(searchUrl);
|
2016-11-26 16:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-28 23:10:04 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CQ dom = results.Content;
|
|
|
|
|
|
2017-08-22 17:12:42 +00:00
|
|
|
|
var rows = dom["#sortabletable tr:has(a[href*=\"details.php?id=\"])"];
|
2015-07-28 23:10:04 +00:00
|
|
|
|
foreach (var row in rows.Skip(1))
|
|
|
|
|
{
|
|
|
|
|
var release = new ReleaseInfo();
|
|
|
|
|
var qRow = row.Cq();
|
2016-11-01 18:51:27 +00:00
|
|
|
|
|
2017-04-15 08:45:10 +00:00
|
|
|
|
var qDetails = qRow.Find("div > a[href*=\"details.php?id=\"]"); // details link, release name get's shortened if it's to long
|
|
|
|
|
var qTitle = qRow.Find("td:eq(1) .tooltip-content div:eq(0)"); // use Title from tooltip
|
|
|
|
|
if (!qTitle.Any()) // fallback to Details link if there's no tooltip
|
|
|
|
|
{
|
|
|
|
|
qTitle = qDetails;
|
|
|
|
|
}
|
2016-11-01 18:51:27 +00:00
|
|
|
|
release.Title = qTitle.Text();
|
|
|
|
|
|
|
|
|
|
var qDesciption = qRow.Find(".tooltip-content > div");
|
|
|
|
|
if (qDesciption.Any())
|
|
|
|
|
release.Description = qDesciption.Get(1).InnerText.Trim();
|
2015-07-28 23:10:04 +00:00
|
|
|
|
|
|
|
|
|
var qLink = row.Cq().Find("td:eq(2) a:eq(1)");
|
|
|
|
|
release.Link = new Uri(qLink.Attr("href"));
|
|
|
|
|
release.Guid = release.Link;
|
2016-11-01 18:51:27 +00:00
|
|
|
|
release.Comments = new Uri(qDetails.Attr("href"));
|
2015-07-28 23:10:04 +00:00
|
|
|
|
|
|
|
|
|
// 07-22-2015 11:08 AM
|
2016-10-27 07:35:31 +00:00
|
|
|
|
var dateString = qRow.Find("td:eq(1) div").Last().Get(0).LastChild.ToString().Trim();
|
2015-07-28 23:10:04 +00:00
|
|
|
|
release.PublishDate = DateTime.ParseExact(dateString, "MM-dd-yyyy hh:mm tt", CultureInfo.InvariantCulture);
|
|
|
|
|
|
|
|
|
|
var sizeStr = qRow.Find("td:eq(4)").Text().Trim();
|
|
|
|
|
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
|
|
|
|
|
|
|
|
|
release.Seeders = ParseUtil.CoerceInt(qRow.Find("td:eq(6)").Text().Trim());
|
|
|
|
|
release.Peers = ParseUtil.CoerceInt(qRow.Find("td:eq(7)").Text().Trim()) + release.Seeders;
|
|
|
|
|
|
|
|
|
|
var catLink = row.Cq().Find("td:eq(0) a").First().Attr("href");
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
var grabs = qRow.Find("td:nth-child(6)").Text();
|
|
|
|
|
release.Grabs = ParseUtil.CoerceInt(grabs);
|
|
|
|
|
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (qRow.Find("img[title^=\"Free Torrent\"]").Length >= 1)
|
|
|
|
|
release.DownloadVolumeFactor = 0;
|
|
|
|
|
else if (qRow.Find("img[title^=\"Silver Torrent\"]").Length >= 1)
|
|
|
|
|
release.DownloadVolumeFactor = 0.5;
|
2016-10-27 07:35:31 +00:00
|
|
|
|
else
|
|
|
|
|
release.DownloadVolumeFactor = 1;
|
|
|
|
|
|
|
|
|
|
release.UploadVolumeFactor = 1;
|
|
|
|
|
|
2015-07-28 23:10:04 +00:00
|
|
|
|
releases.Add(release);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
OnParseError(results.Content, ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return releases;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|