mirror of https://github.com/Jackett/Jackett
New indexer - Hebits.net (#406)
* Added Hebits.net as an indexer - a private Israel tracker * Added new indexer Hebits to the readme file * Deleted debug messages leftovers
This commit is contained in:
parent
45fb2a27c3
commit
ac5e69a3b2
|
@ -34,6 +34,7 @@ Developer note: The software implements the [Torznab](https://github.com/Sonarr/
|
|||
* Fuzer
|
||||
* HD-Space
|
||||
* HD-Torrents
|
||||
* Hebits
|
||||
* Hounddawgs
|
||||
* ILoveTorrents
|
||||
* Immortalseed
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
|
@ -0,0 +1,144 @@
|
|||
using CsQuery;
|
||||
using Jackett.Models;
|
||||
using Jackett.Services;
|
||||
using Jackett.Utils;
|
||||
using Jackett.Utils.Clients;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Jackett.Models.IndexerConfig;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Jackett.Indexers
|
||||
{
|
||||
public class Hebits : BaseIndexer, IIndexer
|
||||
{
|
||||
private string LoginUrl { get { return SiteLink + "login.php"; } }
|
||||
private string LoginPostUrl { get { return SiteLink + "takeloginAjax.php"; } }
|
||||
private string SearchUrl { get { return SiteLink + "browse.php?sort=4&type=desc"; } }
|
||||
|
||||
new ConfigurationDataBasicLogin configData
|
||||
{
|
||||
get { return (ConfigurationDataBasicLogin)base.configData; }
|
||||
set { base.configData = value; }
|
||||
}
|
||||
|
||||
public Hebits(IIndexerManagerService i, Logger l, IWebClient wc, IProtectionService ps)
|
||||
: base(name: "Hebits",
|
||||
description: "The Israeli Tracker",
|
||||
link: "https://hebits.net/",
|
||||
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
|
||||
manager: i,
|
||||
client: wc,
|
||||
logger: l,
|
||||
p: ps,
|
||||
downloadBase: "https://hebits.net/",
|
||||
configData: new ConfigurationDataBasicLogin())
|
||||
{
|
||||
|
||||
AddCategoryMapping(19, TorznabCatType.MoviesSD);
|
||||
AddCategoryMapping(25, TorznabCatType.MoviesOther); // Israeli Content
|
||||
AddCategoryMapping(20, TorznabCatType.MoviesDVD);
|
||||
AddCategoryMapping(36, TorznabCatType.MoviesBluRay);
|
||||
AddCategoryMapping(27, TorznabCatType.MoviesHD);
|
||||
|
||||
AddCategoryMapping(7, TorznabCatType.TVSD); // Israeli SDTV
|
||||
AddCategoryMapping(24, TorznabCatType.TVSD); // English SDTV
|
||||
AddCategoryMapping(1, TorznabCatType.TVHD); // Israel HDTV
|
||||
AddCategoryMapping(37, TorznabCatType.TVHD); // Israel HDTV
|
||||
}
|
||||
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
{ "username", configData.Username.Value },
|
||||
{ "password", configData.Password.Value }
|
||||
};
|
||||
|
||||
// Get inital cookies
|
||||
CookieHeader = string.Empty;
|
||||
var result = await RequestLoginAndFollowRedirect(LoginPostUrl, pairs, CookieHeader, true, null, SiteLink);
|
||||
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("OK"), () =>
|
||||
{
|
||||
CQ dom = result.Content;
|
||||
var messageEl = dom["#errorMsg"].Last();
|
||||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
{
|
||||
var releases = new List<ReleaseInfo>();
|
||||
var searchString = query.GetQueryString();
|
||||
var searchUrl = SearchUrl;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchString))
|
||||
{
|
||||
searchUrl += "&search=" + HttpUtility.UrlEncode(searchString);
|
||||
}
|
||||
string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
|
||||
|
||||
var cats = MapTorznabCapsToTrackers(query);
|
||||
if (cats.Count > 0)
|
||||
{
|
||||
foreach (var cat in cats)
|
||||
{
|
||||
searchUrl += "&c" + cat + "=1";
|
||||
}
|
||||
}
|
||||
|
||||
var results = await RequestStringWithCookiesAndRetry(searchUrl);
|
||||
try
|
||||
{
|
||||
CQ dom = results.Content;
|
||||
|
||||
CQ qRows = dom[".browse > div > div"];
|
||||
|
||||
foreach (var row in qRows)
|
||||
{
|
||||
var release = new ReleaseInfo();
|
||||
|
||||
var qRow = row.Cq();
|
||||
|
||||
var debug = qRow.Html();
|
||||
|
||||
release.MinimumRatio = 1;
|
||||
release.MinimumSeedTime = 172800;
|
||||
|
||||
release.Title = qRow.Find(".bTitle").Text().Split('/')[1].Trim();
|
||||
release.Link = new Uri(SiteLink + qRow.Find("a").Attr("href"));
|
||||
release.Guid = release.Link;
|
||||
|
||||
var dateString = qRow.Find("div:last-child").Text().Trim();
|
||||
var pattern = "\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}";
|
||||
var match = Regex.Match(dateString, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
release.PublishDate = DateTime.ParseExact(match.Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
var sizeStr = qRow.Find(".bSize").Text();
|
||||
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
||||
release.Seeders = ParseUtil.CoerceInt(qRow.Find(".bUping").Text().Trim());
|
||||
release.Peers = release.Seeders + ParseUtil.CoerceInt(qRow.Find(".bDowning").Text().Trim());
|
||||
|
||||
releases.Add(release);
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnParseError(results.Content, ex);
|
||||
}
|
||||
|
||||
return releases;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -186,6 +186,7 @@
|
|||
<Compile Include="Controllers\TorznabController.cs" />
|
||||
<Compile Include="Controllers\DownloadController.cs" />
|
||||
<Compile Include="Engine.cs" />
|
||||
<Compile Include="Indexers\Hebits.cs" />
|
||||
<Compile Include="Indexers\MyAnonamouse.cs" />
|
||||
<Compile Include="Indexers\PassThePopcorn.cs" />
|
||||
<Compile Include="Indexers\Xthor.cs" />
|
||||
|
@ -623,6 +624,9 @@
|
|||
<Content Include="Content\setup_indexer.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\logos\hebits.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Models\TorznabCatType.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>TorznabCatType.generated.cs</LastGenOutput>
|
||||
|
@ -683,4 +687,4 @@
|
|||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
Loading…
Reference in New Issue