2020-02-09 02:35:16 +00:00
|
|
|
using System;
|
2018-12-28 16:52:32 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Specialized;
|
2020-05-03 23:35:52 +00:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2018-12-28 16:52:32 +00:00
|
|
|
using System.Globalization;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Jackett.Common.Models;
|
|
|
|
using Jackett.Common.Models.IndexerConfig;
|
|
|
|
using Jackett.Common.Services.Interfaces;
|
|
|
|
using Jackett.Common.Utils;
|
|
|
|
using Jackett.Common.Utils.Clients;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using NLog;
|
|
|
|
|
|
|
|
namespace Jackett.Common.Indexers
|
|
|
|
{
|
2020-05-03 23:35:52 +00:00
|
|
|
[ExcludeFromCodeCoverage]
|
2018-12-28 16:52:32 +00:00
|
|
|
public class SceneHD : BaseWebIndexer
|
|
|
|
{
|
2020-05-09 21:35:43 +00:00
|
|
|
private string SearchUrl => SiteLink + "browse.php?";
|
2020-11-08 02:11:27 +00:00
|
|
|
private string DetailsUrl => SiteLink + "details.php?";
|
2020-05-09 21:35:43 +00:00
|
|
|
private string DownloadUrl => SiteLink + "download.php?";
|
2018-12-28 16:52:32 +00:00
|
|
|
|
2020-05-09 21:35:43 +00:00
|
|
|
private new ConfigurationDataPasskey configData => (ConfigurationDataPasskey)base.configData;
|
2018-12-28 16:52:32 +00:00
|
|
|
|
2020-12-11 22:14:21 +00:00
|
|
|
public SceneHD(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps,
|
|
|
|
ICacheService cs)
|
2020-05-11 19:59:28 +00:00
|
|
|
: base(id: "scenehd",
|
|
|
|
name: "SceneHD",
|
2020-05-09 21:35:43 +00:00
|
|
|
description: "SceneHD is Private site for HD TV / MOVIES",
|
|
|
|
link: "https://scenehd.org/",
|
|
|
|
configService: configService,
|
|
|
|
caps: new TorznabCapabilities
|
|
|
|
{
|
2020-10-18 20:47:36 +00:00
|
|
|
TvSearchParams = new List<TvSearchParam>
|
|
|
|
{
|
|
|
|
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
|
|
|
|
},
|
|
|
|
MovieSearchParams = new List<MovieSearchParam>
|
|
|
|
{
|
|
|
|
MovieSearchParam.Q, MovieSearchParam.ImdbId
|
2020-10-20 00:38:27 +00:00
|
|
|
},
|
|
|
|
MusicSearchParams = new List<MusicSearchParam>
|
|
|
|
{
|
|
|
|
MusicSearchParam.Q
|
2020-10-18 20:47:36 +00:00
|
|
|
}
|
2020-05-09 21:35:43 +00:00
|
|
|
},
|
|
|
|
client: c,
|
|
|
|
logger: l,
|
|
|
|
p: ps,
|
2020-12-11 22:14:21 +00:00
|
|
|
cacheService: cs,
|
2020-05-09 21:35:43 +00:00
|
|
|
configData: new ConfigurationDataPasskey("You can find the Passkey if you generate a RSS " +
|
|
|
|
"feed link. It's the last parameter in the URL."))
|
2018-12-28 16:52:32 +00:00
|
|
|
{
|
|
|
|
Encoding = Encoding.UTF8;
|
2021-09-08 01:02:29 +00:00
|
|
|
Language = "en-US";
|
2018-12-28 16:52:32 +00:00
|
|
|
Type = "private";
|
2020-04-03 22:37:42 +00:00
|
|
|
|
2020-01-03 04:01:59 +00:00
|
|
|
webclient.AddTrustedCertificate(new Uri(SiteLink).Host, "D948487DD52462F2D1E62B990D608051E3DE5AA6");
|
2018-12-28 16:52:32 +00:00
|
|
|
|
|
|
|
AddCategoryMapping(2, TorznabCatType.MoviesUHD, "Movie/2160");
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesHD, "Movie/1080");
|
|
|
|
AddCategoryMapping(4, TorznabCatType.MoviesHD, "Movie/720");
|
|
|
|
AddCategoryMapping(8, TorznabCatType.MoviesBluRay, "Movie/BD5/9");
|
|
|
|
AddCategoryMapping(6, TorznabCatType.TVUHD, "TV/2160");
|
|
|
|
AddCategoryMapping(5, TorznabCatType.TVHD, "TV/1080");
|
|
|
|
AddCategoryMapping(7, TorznabCatType.TVHD, "TV/720");
|
|
|
|
AddCategoryMapping(22, TorznabCatType.MoviesBluRay, "Bluray/Complete");
|
|
|
|
AddCategoryMapping(10, TorznabCatType.XXX, "XXX");
|
|
|
|
AddCategoryMapping(16, TorznabCatType.MoviesOther, "Subpacks");
|
|
|
|
AddCategoryMapping(13, TorznabCatType.AudioVideo, "MVID");
|
|
|
|
AddCategoryMapping(9, TorznabCatType.Other, "Other");
|
|
|
|
}
|
|
|
|
|
|
|
|
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
|
|
|
{
|
|
|
|
LoadValuesFromJson(configJson);
|
|
|
|
|
2020-05-09 21:35:43 +00:00
|
|
|
if (configData.Passkey.Value.Length != 32)
|
|
|
|
throw new Exception("Invalid Passkey configured. Expected length: 32");
|
2018-12-28 16:52:32 +00:00
|
|
|
|
2020-05-09 21:35:43 +00:00
|
|
|
var releases = await PerformQuery(new TorznabQuery());
|
|
|
|
await ConfigureIfOK(string.Empty, releases.Any(),
|
|
|
|
() => throw new Exception("Could not find releases from this URL."));
|
|
|
|
|
|
|
|
return IndexerConfigurationStatus.Completed;
|
2018-12-28 16:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
|
|
|
{
|
|
|
|
var releases = new List<ReleaseInfo>();
|
2020-05-09 21:35:43 +00:00
|
|
|
var passkey = configData.Passkey.Value;
|
2018-12-28 16:52:32 +00:00
|
|
|
|
2020-05-09 21:35:43 +00:00
|
|
|
var qc = new NameValueCollection
|
2020-03-26 22:15:28 +00:00
|
|
|
{
|
2020-05-09 21:35:43 +00:00
|
|
|
{ "api", "" },
|
|
|
|
{ "passkey", passkey },
|
|
|
|
{ "search", query.IsImdbQuery ? query.ImdbID : query.GetQueryString() }
|
2020-03-26 22:15:28 +00:00
|
|
|
};
|
2018-12-28 16:52:32 +00:00
|
|
|
|
|
|
|
foreach (var cat in MapTorznabCapsToTrackers(query))
|
2020-05-09 21:35:43 +00:00
|
|
|
qc.Add("categories[" + cat + "]", "1");
|
2018-12-28 16:52:32 +00:00
|
|
|
|
2020-05-09 21:35:43 +00:00
|
|
|
var searchUrl = SearchUrl + qc.GetQueryString();
|
2020-06-11 15:09:27 +00:00
|
|
|
var response = await RequestWithCookiesAndRetryAsync(searchUrl);
|
2018-12-28 16:52:32 +00:00
|
|
|
|
2020-06-09 17:36:57 +00:00
|
|
|
if (response.ContentString?.Contains("User not found or passkey not set") == true)
|
2020-05-09 21:35:43 +00:00
|
|
|
throw new Exception("The passkey is invalid. Check the indexer configuration.");
|
2018-12-28 16:52:32 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2020-06-09 17:36:57 +00:00
|
|
|
var jsonContent = JArray.Parse(response.ContentString);
|
2018-12-28 16:52:32 +00:00
|
|
|
foreach (var item in jsonContent)
|
|
|
|
{
|
2020-05-12 22:57:56 +00:00
|
|
|
var title = item.Value<string>("name");
|
|
|
|
if (!query.IsImdbQuery && !query.MatchQueryStringAND(title))
|
|
|
|
continue;
|
|
|
|
|
2018-12-28 16:52:32 +00:00
|
|
|
var id = item.Value<long>("id");
|
2020-11-08 02:11:27 +00:00
|
|
|
var details = new Uri(DetailsUrl + "id=" + id);
|
2020-05-09 21:35:43 +00:00
|
|
|
var link = new Uri(DownloadUrl + "id=" + id + "&passkey=" + passkey);
|
|
|
|
var publishDate = DateTime.ParseExact(item.Value<string>("added"), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
|
|
|
|
var dlVolumeFactor = item.Value<int>("is_freeleech") == 1 ? 0 : 1;
|
|
|
|
|
|
|
|
var release = new ReleaseInfo
|
|
|
|
{
|
2020-05-12 22:57:56 +00:00
|
|
|
Title = title,
|
2020-05-09 21:35:43 +00:00
|
|
|
Link = link,
|
2020-11-08 02:11:27 +00:00
|
|
|
Details = details,
|
|
|
|
Guid = details,
|
2020-05-09 21:35:43 +00:00
|
|
|
Category = MapTrackerCatToNewznab(item.Value<string>("category")),
|
|
|
|
PublishDate = publishDate,
|
|
|
|
Size = item.Value<long>("size"),
|
|
|
|
Grabs = item.Value<long>("times_completed"),
|
|
|
|
Files = item.Value<long>("numfiles"),
|
|
|
|
Seeders = item.Value<int>("seeders"),
|
|
|
|
Peers = item.Value<int>("leechers") + item.Value<int>("seeders"),
|
|
|
|
Imdb = ParseUtil.GetImdbID(item.Value<string>("imdbid")),
|
|
|
|
MinimumRatio = 1,
|
|
|
|
MinimumSeedTime = 0,
|
|
|
|
DownloadVolumeFactor = dlVolumeFactor,
|
|
|
|
UploadVolumeFactor = 1
|
|
|
|
};
|
2018-12-28 16:52:32 +00:00
|
|
|
|
|
|
|
releases.Add(release);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2020-06-09 17:36:57 +00:00
|
|
|
OnParseError(response.ContentString, ex);
|
2018-12-28 16:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return releases;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|