Compare commits

..

22 Commits

Author SHA1 Message Date
unknown
2eebea0683 Implemented T411 2015-07-13 01:13:16 -06:00
unknown
cf7d4cb518 App version increment 2015-07-12 23:57:56 -06:00
unknown
ddd86d2279 Improvement for TPB - combined TV and HDTV search into one 2015-07-12 23:57:14 -06:00
unknown
4996bd57e1 Don't use https for HD-Torrents (doesn't work on mono) 2015-07-12 23:39:41 -06:00
unknown
3fd4b08da2 App version increment 2015-07-12 20:03:04 -06:00
unknown
1a7f3c2e3e Readme update 2015-07-12 20:01:36 -06:00
unknown
f4ad01dda7 Implemented BeyondHD 2015-07-12 20:01:02 -06:00
unknown
f2f50e21fa Moved AnimeBytes helper class into its main class file 2015-07-12 20:00:47 -06:00
unknown
5f011d3222 Implemented SceneTime 2015-07-12 15:43:00 -06:00
unknown
757c3ee87a Minor improvements, bug fixes 2015-07-12 13:50:24 -06:00
Matthew Little
c21c83a13e Merge pull request #79 from damwthomas/master
HDTorrents
2015-07-12 13:18:01 -06:00
ThomasAmpen
9595dad645 Forgotten parse 2015-07-12 19:58:46 +02:00
ThomasAmpen
dd658b2e77 DeletedExtentionmethod 2015-07-12 19:54:37 +02:00
ThomasAmpen
389926d86b BrowserUtil, tryparse added 2015-07-12 19:52:32 +02:00
ThomasAmpen
5744e6ff08 Merge branch 'zone117x/master' 2015-07-12 18:54:45 +02:00
ThomasAmpen
ba89d25563 pull from master 2015-07-12 18:23:40 +02:00
damwthomas
6e575a70e3 Merge pull request #2 from damwthomas/HDTorrents
Hdtorrents
2015-07-12 17:49:36 +02:00
ThomasAmpen
bd8463387b HDTorrents 2015-07-12 17:48:37 +02:00
Matthew Little
3b22973b6d Update README.md 2015-07-11 14:34:13 -06:00
ThomasAmpen
79ee4b4da0 HdTorrents 2015-07-11 21:27:57 +02:00
ThomasAmpen
ecdd1f655b Pull from master 2015-07-09 22:24:20 +02:00
ThomasAmpen
387f367041 Auth(Still disabled), chaing port, stripped special chars in serie name 2015-07-09 21:38:12 +02:00
26 changed files with 954 additions and 56 deletions

View File

@@ -1,5 +1,7 @@
# Jackett
Use just about any tracker with Sonarr
### API Access to your favorite trackers
This software creates a [Torznab](https://github.com/Sonarr/Sonarr/wiki/Implementing-a-Torznab-indexer) API server on your machine that any Torznab enabled software can consume. Jackett works as a proxy server: it translates Torznab queries into tracker-site-specific http queries, parses the html response into Torznab results, then sends results back to the requesting software.
@@ -31,11 +33,14 @@ Download in the [Releases page](https://github.com/zone117x/Jackett/releases)
* [RARBG](https://rarbg.com)
* [TorrentDay](https://torrentday.eu/)
* [TorrentShack](http://torrentshack.me/)
* AlphaRatio
* AnimeBytes
* SceneAccess
* ShowRSS
* Torrentz
* [AlphaRatio](https://alpharatio.cc/)
* [AnimeBytes](https://animebytes.tv/)
* [SceneAccess](https://sceneaccess.eu/login)
* [ShowRSS](https://showrss.info/)
* [Torrentz](https://torrentz.eu/)
* [HD-Torrents.org](https://hd-torrents.org/)
* [SceneTime](https://www.scenetime.com/)
* [BeyondHD](https://beyondhd.me/)
### Additional Trackers

View File

@@ -1,26 +1,35 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett", "Jackett\Jackett.csproj", "{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CurlSharp", "CurlSharp\CurlSharp.csproj", "{74420A79-CC16-442C-8B1E-7C1B913844F0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BE7B0C8A-6144-47CD-821E-B09BA1B7BADE}"
ProjectSection(SolutionItems) = preProject
..\LICENSE = ..\LICENSE
..\README.md = ..\README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.Build.0 = Release|Any CPU
{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}.Release|Any CPU.Build.0 = Release|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
@@ -57,7 +66,4 @@ Global
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett
{
public static class BrowserUtil
{
public static string ChromeUserAgent
{
get { return "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36"; }
}
}
}

View File

@@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett
{
public class ConfigurationDataBasicLoginAnimeBytes : ConfigurationDataBasicLogin
{
public BoolItem IncludeRaw { get; private set; }
public DisplayItem RageIdWarning { get; private set; }
public DisplayItem DateWarning { get; private set; }
public ConfigurationDataBasicLoginAnimeBytes(): base()
{
IncludeRaw = new BoolItem() { Name = "IncludeRaw", Value = false };
RageIdWarning = new DisplayItem("Ensure rageid lookup is disabled in Sonarr for this tracker.") { Name = "RageWarning" };
DateWarning = new DisplayItem("This tracker does not supply upload dates so they are based off year of release.") { Name = "DateWarning" };
}
public override Item[] GetItems()
{
return new Item[] { Username, Password, IncludeRaw, RageIdWarning, DateWarning };
}
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett
{
public class ConfigurationDataCookie : ConfigurationData
{
public StringItem Cookie { get; private set; }
public DisplayItem CookieHint { get; private set; }
public DisplayItem CookieExample { get; private set; }
public ConfigurationDataCookie()
{
Cookie = new StringItem { Name = "Cookie" };
CookieHint = new DisplayItem(
"<ol><li>Login to BeyondHD in your browser <li>Open the developer console, go the network tab <li>Find 'cookie' in the request headers <li>Copy & paste it to here</ol>")
{
Name = "CookieHint"
};
CookieExample = new DisplayItem(
"Example cookie header (usually longer than this):<br><code>PHPSESSID=8rk27odm; ipsconnect_63ad9c=1; more_stuff=etc;</code>")
{
Name = "CookieExample"
};
}
public override Item[] GetItems()
{
return new Item[] { Cookie, CookieHint, CookieExample };
}
public string CookieHeader
{
get
{
return Cookie.Value.Trim().TrimStart(new char[] { '"' }).TrimEnd(new char[] { '"' });
}
}
}
}

View File

@@ -45,7 +45,7 @@ namespace Jackett.Indexers
static string GuidUrl = BaseUrl + "/torrents.php?torrentid=";
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
CookieContainer cookies;
HttpClientHandler handler;

View File

@@ -16,13 +16,33 @@ namespace Jackett.Indexers
{
public class AnimeBytes : IndexerInterface
{
class ConfigurationDataBasicLoginAnimeBytes : ConfigurationDataBasicLogin
{
public BoolItem IncludeRaw { get; private set; }
public DisplayItem RageIdWarning { get; private set; }
public DisplayItem DateWarning { get; private set; }
public ConfigurationDataBasicLoginAnimeBytes()
: base()
{
IncludeRaw = new BoolItem() { Name = "IncludeRaw", Value = false };
RageIdWarning = new DisplayItem("Ensure rageid lookup is disabled in Sonarr for this tracker.") { Name = "RageWarning" };
DateWarning = new DisplayItem("This tracker does not supply upload dates so they are based off year of release.") { Name = "DateWarning" };
}
public override Item[] GetItems()
{
return new Item[] { Username, Password, IncludeRaw, RageIdWarning, DateWarning };
}
}
private static List<CachedResult> cache = new List<CachedResult>();
private static readonly TimeSpan cacheTime = new TimeSpan(0, 9, 0);
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
public string DisplayName
{

View File

@@ -0,0 +1,180 @@
using CsQuery;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Jackett.Indexers
{
public class BeyondHD : IndexerInterface
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public string DisplayName
{
get { return "BeyondHD"; }
}
public string DisplayDescription
{
get { return "Without BeyondHD, your HDTV is just a TV"; }
}
public Uri SiteLink
{
get { return new Uri(BaseUrl); }
}
public bool IsConfigured { get; private set; }
const string BaseUrl = "https://beyondhd.me";
const string SearchUrl = BaseUrl + "/browse.php?c40=1&c44=1&c48=1&c89=1&c46=1&c45=1&searchin=title&incldead=0&search={0}";
const string DownloadUrl = BaseUrl + "/download.php?torrent={0}";
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
public BeyondHD()
{
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
{
CookieContainer = cookies,
AllowAutoRedirect = true,
UseCookies = true,
};
client = new HttpClient(handler);
}
public Task<ConfigurationData> GetConfigurationForSetup()
{
var config = new ConfigurationDataCookie();
return Task.FromResult<ConfigurationData>(config);
}
public async Task ApplyConfiguration(JToken configJson)
{
var config = new ConfigurationDataCookie();
config.LoadValuesFromJson(configJson);
var jsonCookie = new JObject();
jsonCookie["cookie_header"] = config.CookieHeader;
cookies.FillFromJson(new Uri(BaseUrl), jsonCookie);
var responseContent = await client.GetStringAsync(BaseUrl);
if (!responseContent.Contains("logout.php"))
{
CQ dom = responseContent;
throw new ExceptionWithConfigData("Invalid cookie header", (ConfigurationData)config);
}
else
{
var configSaveData = new JObject();
cookies.DumpToJson(SiteLink, configSaveData);
if (OnSaveConfigurationRequested != null)
OnSaveConfigurationRequested(this, configSaveData);
IsConfigured = true;
}
}
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
IsConfigured = true;
}
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
foreach (var title in query.ShowTitles ?? new string[] { string.Empty })
{
var searchString = title + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await client.GetStringAsync(episodeSearchUrl);
try
{
CQ dom = results;
var rows = dom["table.torrenttable > tbody > tr.browse_color"];
foreach (var row in rows)
{
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var qRow = row.Cq();
var qLink = row.ChildElements.ElementAt(2).FirstChild.Cq();
release.Link = new Uri(BaseUrl + "/" + qLink.Attr("href"));
var torrentID = qLink.Attr("href").Split('=').Last();
var descCol = row.ChildElements.ElementAt(3);
var qCommentLink = descCol.FirstChild.Cq();
release.Title = qCommentLink.Text();
release.Description = release.Title;
release.Comments = new Uri(BaseUrl + "/" + qCommentLink.Attr("href"));
release.Guid = release.Comments;
var dateStr = descCol.ChildElements.Last().Cq().Text().Split('|').Last().ToLowerInvariant().Replace("ago.", "").Trim();
var dateParts = dateStr.Split(new char[] { ' ', ' ' }, StringSplitOptions.RemoveEmptyEntries);
var timeSpan = TimeSpan.Zero;
for (var i = 0; i < dateParts.Length / 2; i++)
{
var timeVal = ParseUtil.CoerceInt(dateParts[i * 2]);
var timeUnit = dateParts[i * 2 + 1];
if (timeUnit.Contains("year"))
timeSpan += TimeSpan.FromDays(365 * timeVal);
else if (timeUnit.Contains("month"))
timeSpan += TimeSpan.FromDays(30 * timeVal);
else if (timeUnit.Contains("day"))
timeSpan += TimeSpan.FromDays(timeVal);
else if (timeUnit.Contains("hour"))
timeSpan += TimeSpan.FromHours(timeVal);
else if (timeUnit.Contains("min"))
timeSpan += TimeSpan.FromMinutes(timeVal);
}
release.PublishDate = DateTime.SpecifyKind(DateTime.Now - timeSpan, DateTimeKind.Local);
var sizeEl = row.ChildElements.ElementAt(7);
var sizeVal = ParseUtil.CoerceFloat(sizeEl.ChildNodes.First().NodeValue);
var sizeUnit = sizeEl.ChildNodes.Last().NodeValue;
release.Size = ReleaseInfo.GetBytes(sizeUnit, sizeVal);
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(9).Cq().Text());
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(10).Cq().Text()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnResultParsingError(this, results, ex);
throw ex;
}
}
return releases.ToArray();
}
public Task<byte[]> Download(Uri link)
{
return client.GetByteArrayAsync(link);
}
}
}

View File

@@ -23,7 +23,7 @@ namespace Jackett
static string LoginPostUrl = BaseUrl + "/login.php?action=makelogin";
static string SearchUrl = BaseUrl + "/browse.php";
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
CookieContainer cookies;
HttpClientHandler handler;

View File

@@ -0,0 +1,243 @@
using CsQuery;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Jackett.Indexers
{
public class HDTorrents : IndexerInterface
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
const string DefaultUrl = "http://hd-torrents.org";
string BaseUrl = DefaultUrl;
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
private string SearchUrl = DefaultUrl + "/torrents.php?search={0}&active=1&options=0&category%5B%5D=59&category%5B%5D=60&category%5B%5D=30&category%5B%5D=38&page={1}";
private static string LoginUrl = DefaultUrl + "/login.php";
private static string LoginPostUrl = DefaultUrl + "/login.php?returnto=index.php";
private const int MAXPAGES = 3;
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
public HDTorrents()
{
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
{
CookieContainer = cookies,
AllowAutoRedirect = true,
UseCookies = true,
};
client = new HttpClient(handler);
}
public string DisplayName
{
get { return "HD-Torrents"; }
}
public string DisplayDescription
{
get { return "HD-Torrents is a private torrent website with HD torrents and strict rules on their content."; }
}
public Uri SiteLink
{
get { return new Uri(DefaultUrl); }
}
public bool IsConfigured
{
get;
private set;
}
public Task<ConfigurationData> GetConfigurationForSetup()
{
var config = new ConfigurationDataBasicLogin();
return Task.FromResult<ConfigurationData>(config);
}
HttpRequestMessage CreateHttpRequest(string url)
{
var message = new HttpRequestMessage();
message.Method = HttpMethod.Get;
message.RequestUri = new Uri(url);
message.Headers.UserAgent.ParseAdd(chromeUserAgent);
return message;
}
public async Task ApplyConfiguration(JToken configJson)
{
var config = new ConfigurationDataBasicLogin();
config.LoadValuesFromJson(configJson);
var startMessage = CreateHttpRequest(LoginUrl);
var results = await (await client.SendAsync(startMessage)).Content.ReadAsStringAsync();
var pairs = new Dictionary<string, string> {
{ "uid", config.Username.Value },
{ "pwd", config.Password.Value }
};
var content = new FormUrlEncodedContent(pairs);
var loginRequest = CreateHttpRequest(LoginUrl);
loginRequest.Method = HttpMethod.Post;
loginRequest.Content = content;
loginRequest.Headers.Referrer = new Uri("https://hd-torrents.org/torrents.php");
var response = await client.SendAsync(loginRequest);
var responseContent = await response.Content.ReadAsStringAsync();
if (!responseContent.Contains("If your browser doesn't have javascript enabled"))
{
var errorMessage = "Couldn't login";
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)config);
}
else
{
var configSaveData = new JObject();
cookies.DumpToJson(SiteLink, configSaveData);
if (OnSaveConfigurationRequested != null)
OnSaveConfigurationRequested(this, configSaveData);
IsConfigured = true;
}
}
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(SiteLink, jsonConfig);
IsConfigured = true;
}
async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query, string baseUrl)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
List<string> searchurls = new List<string>();
foreach (var title in query.ShowTitles ?? new string[] { string.Empty })
{
var searchString = title + " " + query.GetEpisodeSearchString();
for (int page = 0; page < MAXPAGES; page++)
searchurls.Add(string.Format(SearchUrl, HttpUtility.UrlEncode(searchString.Trim()), page));
}
foreach (string SearchUrl in searchurls)
{
var results = await client.GetStringAsync(SearchUrl);
try
{
CQ dom = results;
ReleaseInfo release;
int rowCount = 0;
var rows = dom[".mainblockcontenttt > tbody > tr"];
foreach (var row in rows)
{
CQ qRow = row.Cq();
if (rowCount < 2 || qRow.Children().Count() != 12) //skip 2 rows because there's an empty row & a title/sort row
{
rowCount++;
continue;
}
release = new ReleaseInfo();
long? size;
release.Title = qRow.Find("td.mainblockcontent b a").Text();
release.Description = release.Title;
if (0 != qRow.Find("td.mainblockcontent u").Length)
{
var imdbStr = qRow.Find("td.mainblockcontent u").Parent().First().Attr("href").Replace("http://www.imdb.com/title/tt", "").Replace("/", "");
long imdb;
if (ParseUtil.TryCoerceLong(imdbStr, out imdb))
{
release.Imdb = imdb;
}
}
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
release.MagnetUri = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent").Get(3).FirstChild.GetAttribute("href"));
int seeders, peers;
if (ParseUtil.TryCoerceInt(qRow.Find("td").Get(9).FirstChild.FirstChild.InnerText, out seeders))
{
release.Seeders = seeders;
if (ParseUtil.TryCoerceInt(qRow.Find("td").Get(10).FirstChild.FirstChild.InnerText, out peers))
{
release.Peers = peers + release.Seeders;
}
}
string fullSize = qRow.Find("td.mainblockcontent").Get(6).InnerText;
string[] sizeSplit = fullSize.Split(' ');
switch (sizeSplit[1].ToLower())
{
case "kb":
size = ReleaseInfo.BytesFromKB(ParseUtil.CoerceFloat(sizeSplit[0]));
break;
case "mb":
size = ReleaseInfo.BytesFromMB(ParseUtil.CoerceFloat(sizeSplit[0]));
break;
case "gb":
size = ReleaseInfo.BytesFromGB(ParseUtil.CoerceFloat(sizeSplit[0]));
break;
default:
size = null;
break;
}
release.Size = size;
release.Link = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent b a").Attr("href"));
release.Guid = release.Link;
string[] dateSplit = qRow.Find("td.mainblockcontent").Get(5).InnerHTML.Split(',');
string dateString = dateSplit[1].Substring(0, dateSplit[1].IndexOf('>'));
release.PublishDate = DateTime.Parse(dateString, CultureInfo.InvariantCulture);
release.Comments = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent").Get(2).FirstChild.GetAttribute("href"));
releases.Add(release);
}
}
catch (Exception ex)
{
OnResultParsingError(this, results, ex);
throw ex;
}
}
return releases.ToArray();
}
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query)
{
return await PerformQuery(query, BaseUrl);
}
public Task<byte[]> Download(Uri link)
{
throw new NotImplementedException();
}
}
}

View File

@@ -26,7 +26,7 @@ namespace Jackett.Indexers
public bool IsConfigured { get; private set; }
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
static string BaseUrl = "https://iptorrents.com";

View File

@@ -39,7 +39,7 @@ namespace Jackett.Indexers
const string SearchTVRageUrl = "/pubapi.php?mode=search&search_tvrage={0}&token={1}&format=json&min_seeders=1";
const string SearchQueryUrl = "/pubapi.php?mode=search&search_string={0}&token={1}&format=json&min_seeders=1";
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
string BaseUrl;

View File

@@ -0,0 +1,179 @@
using CsQuery;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Jackett.Indexers
{
public class SceneTime : IndexerInterface
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public string DisplayName
{
get { return "SceneTime"; }
}
public string DisplayDescription
{
get { return "Always on time"; }
}
public Uri SiteLink
{
get { return new Uri(BaseUrl); }
}
public bool IsConfigured { get; private set; }
const string BaseUrl = "https://www.scenetime.com";
const string LoginUrl = BaseUrl + "/takelogin.php";
const string SearchUrl = BaseUrl + "/browse_API.php";
const string DownloadUrl = BaseUrl + "/download.php/{0}/download.torrent";
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
public SceneTime()
{
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
{
CookieContainer = cookies,
AllowAutoRedirect = true,
UseCookies = true,
};
client = new HttpClient(handler);
}
public Task<ConfigurationData> GetConfigurationForSetup()
{
var config = new ConfigurationDataBasicLogin();
return Task.FromResult<ConfigurationData>(config);
}
public async Task ApplyConfiguration(JToken configJson)
{
var config = new ConfigurationDataBasicLogin();
config.LoadValuesFromJson(configJson);
var pairs = new Dictionary<string, string> {
{ "username", config.Username.Value },
{ "password", config.Password.Value }
};
var content = new FormUrlEncodedContent(pairs);
var response = await client.PostAsync(LoginUrl, content);
var responseContent = await response.Content.ReadAsStringAsync();
if (!responseContent.Contains("logout.php"))
{
CQ dom = responseContent;
var errorMessage = dom["td.text"].Text().Trim();
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)config);
}
else
{
var configSaveData = new JObject();
cookies.DumpToJson(SiteLink, configSaveData);
if (OnSaveConfigurationRequested != null)
OnSaveConfigurationRequested(this, configSaveData);
IsConfigured = true;
}
}
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
IsConfigured = true;
}
FormUrlEncodedContent GetSearchFormData(string searchString)
{
var pairs = new Dictionary<string, string> {
{ "c2", "1" }, { "c43", "1" }, { "c9", "1" }, { "c63", "1" }, { "c77", "1" }, { "c100", "1" }, { "c101", "1" },
{ "cata", "yes" }, { "sec", "jax" },
{ "search", searchString}
};
var content = new FormUrlEncodedContent(pairs);
return content;
}
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
foreach (var title in query.ShowTitles ?? new string[] { string.Empty })
{
var searchString = title + " " + query.GetEpisodeSearchString();
var searchContent = GetSearchFormData(searchString);
var response = await client.PostAsync(SearchUrl, searchContent);
var results = await response.Content.ReadAsStringAsync();
try
{
CQ dom = results;
var rows = dom["tr.browse"];
foreach (var row in rows)
{
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var descCol = row.ChildElements.ElementAt(1);
var qDescCol = descCol.Cq();
var qLink = qDescCol.Find("a");
release.Title = qLink.Text();
release.Description = release.Title;
release.Comments = new Uri(BaseUrl + "/" + qLink.Attr("href"));
release.Guid = release.Comments;
var torrentId = qLink.Attr("href").Split('=')[1];
release.Link = new Uri(string.Format(DownloadUrl, torrentId));
var dateStr = descCol.ChildNodes.Last().NodeValue.Trim();
var euDate = DateTime.ParseExact(dateStr, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
var localDate = TimeZoneInfo.ConvertTimeToUtc(euDate, TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time")).ToLocalTime();
release.PublishDate = localDate;
var sizeNodes = row.ChildElements.ElementAt(3).ChildNodes;
var sizeVal = sizeNodes.First().NodeValue;
var sizeUnit = sizeNodes.Last().NodeValue;
release.Size = ReleaseInfo.GetBytes(sizeUnit, ParseUtil.CoerceFloat(sizeVal));
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(4).Cq().Text().Trim());
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(5).Cq().Text().Trim()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnResultParsingError(this, results, ex);
throw ex;
}
}
return releases.ToArray();
}
public Task<byte[]> Download(Uri link)
{
return client.GetByteArrayAsync(link);
}
}
}

View File

@@ -36,7 +36,7 @@ namespace Jackett.Indexers
const string DefaultUrl = "http://showrss.info";
const string searchAllUrl = DefaultUrl + "/feeds/all.rss";
string BaseUrl;
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
CookieContainer cookies;
HttpClientHandler handler;
@@ -135,7 +135,6 @@ namespace Jackett.Indexers
}
ReleaseInfo release;
TorrentzHelper td;
string serie_title;
foreach (XmlNode node in xmlDoc.GetElementsByTagName("item"))

View File

@@ -0,0 +1,200 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Jackett.Indexers
{
public class T411 : IndexerInterface
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public string DisplayName
{
get { return "T411"; }
}
public string DisplayDescription
{
get { return "French Torrent Tracker"; }
}
public Uri SiteLink
{
get { return new Uri(BaseUrl); }
}
public bool IsConfigured { get; private set; }
const string BaseUrl = "http://www.t411.io";
const string CommentsUrl = BaseUrl + "/torrents/{0}";
const string ApiUrl = "http://api.t411.io";
const string AuthUrl = ApiUrl + "/auth";
const string SearchUrl = ApiUrl + "/torrents/search/{0}";
const string DownloadUrl = ApiUrl + "/torrents/download/{0}";
HttpClientHandler handler;
HttpClient client;
string username = string.Empty;
string password = string.Empty;
string token = string.Empty;
DateTime lastTokenFetch = DateTime.MinValue;
public T411()
{
IsConfigured = false;
handler = new HttpClientHandler
{
AllowAutoRedirect = true
};
client = new HttpClient(handler);
}
public Task<ConfigurationData> GetConfigurationForSetup()
{
var config = new ConfigurationDataBasicLogin();
return Task.FromResult<ConfigurationData>(config);
}
async Task<string> GetAuthToken(bool forceFetch = false)
{
if (!forceFetch && lastTokenFetch > DateTime.Now - TimeSpan.FromHours(48))
{
return token;
}
var pairs = new Dictionary<string, string> {
{ "username", username },
{ "password", password }
};
var content = new FormUrlEncodedContent(pairs);
var response = await client.PostAsync(AuthUrl, content);
var responseContent = await response.Content.ReadAsStringAsync();
var jsonResponse = JObject.Parse(responseContent);
if (jsonResponse["error"] != null)
{
throw new ApplicationException((string)jsonResponse["error"]);
}
token = (string)jsonResponse["token"];
lastTokenFetch = DateTime.Now;
return token;
}
public async Task ApplyConfiguration(JToken configJson)
{
var config = new ConfigurationDataBasicLogin();
config.LoadValuesFromJson(configJson);
username = config.Username.Value;
password = config.Password.Value;
try
{
await GetAuthToken(true);
}
catch (Exception ex)
{
throw new ExceptionWithConfigData(ex.Message, (ConfigurationData)config);
}
var configSaveData = new JObject();
configSaveData["username"] = username;
configSaveData["password"] = password;
configSaveData["token"] = token;
configSaveData["last_token_fetch"] = lastTokenFetch;
if (OnSaveConfigurationRequested != null)
OnSaveConfigurationRequested(this, configSaveData);
IsConfigured = true;
}
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
username = (string)jsonConfig["username"];
password = (string)jsonConfig["password"];
token = (string)jsonConfig["token"];
lastTokenFetch = (DateTime)jsonConfig["last_token_fetch"];
IsConfigured = true;
}
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
foreach (var title in query.ShowTitles ?? new string[] { "%20" })
{
var searchString = title + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var message = new HttpRequestMessage();
message.Method = HttpMethod.Get;
message.RequestUri = new Uri(episodeSearchUrl);
message.Headers.TryAddWithoutValidation("Authorization", token);
var response = await client.SendAsync(message);
var results = await response.Content.ReadAsStringAsync();
var jsonResult = JObject.Parse(results);
try
{
var items = (JArray)jsonResult["torrents"];
foreach (var item in items)
{
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var torrentId = (string)item["id"];
release.Link = new Uri(string.Format(DownloadUrl, torrentId));
release.Title = (string)item["name"];
release.Description = release.Title;
release.Comments = new Uri(string.Format(CommentsUrl, (string)item["rewritename"]));
release.Guid = release.Comments;
var dateUtc = DateTime.ParseExact((string)item["added"], "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
release.PublishDate = DateTime.SpecifyKind(dateUtc, DateTimeKind.Utc).ToLocalTime();
release.Seeders = ParseUtil.CoerceInt((string)item["seeders"]);
release.Peers = ParseUtil.CoerceInt((string)item["leechers"]) + release.Seeders;
release.Size = ParseUtil.CoerceLong((string)item["size"]);
releases.Add(release);
}
}
catch (Exception ex)
{
OnResultParsingError(this, results, ex);
throw ex;
}
}
return releases.ToArray();
}
public async Task<byte[]> Download(Uri link)
{
var message = new HttpRequestMessage();
message.Method = HttpMethod.Get;
message.RequestUri = link;
message.Headers.TryAddWithoutValidation("Authorization", token);
var response = await client.SendAsync(message);
return await response.Content.ReadAsByteArrayAsync();
}
}
}

View File

@@ -29,8 +29,7 @@ namespace Jackett.Indexers
public bool IsConfigured { get; private set; }
const string DefaultUrl = "https://thepiratebay.mn";
const string SearchUrl = "/search/{0}/0/99/208";
const string SearchUrl2 = "/search/{0}/0/99/205";
const string SearchUrl = "/search/{0}/0/99/208,205";
string BaseUrl;
@@ -101,9 +100,7 @@ namespace Jackett.Indexers
var searchString = title + " " + query.GetEpisodeSearchString();
var queryStr = HttpUtility.UrlEncode(searchString);
var episodeSearchUrl = baseUrl + string.Format(SearchUrl, queryStr);
var episodeSearchUrl2 = baseUrl + string.Format(SearchUrl2, queryStr);
searchUrls.Add(episodeSearchUrl);
searchUrls.Add(episodeSearchUrl2);
}
foreach (var episodeSearchUrl in searchUrls)

View File

@@ -40,7 +40,7 @@ namespace Jackett.Indexers
const string LoginUrl = BaseUrl + "/tak3login.php";
const string SearchUrl = BaseUrl + "/browse.php?search={0}&cata=yes&c2=1&c7=1&c14=1&c24=1&c26=1&c31=1&c32=1&c33=1";
const string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
CookieContainer cookies;
HttpClientHandler handler;

View File

@@ -35,7 +35,7 @@ namespace Jackett.Indexers
const string DefaultUrl = "https://torrentz.eu";
const string SearchUrl = DefaultUrl + "/feed_verifiedP?f={0}";
string BaseUrl;
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
CookieContainer cookies;
HttpClientHandler handler;
@@ -144,7 +144,7 @@ namespace Jackett.Indexers
release.InfoHash = td.hash;
release.Size = td.Size;
release.Seeders = td.Seeders;
release.Peers = td.Peers;
release.Peers = td.Peers + release.Seeders;
release.MagnetUri = TorrentzHelper.createMagnetLink(td.hash, serie_title);
releases.Add(release);
}

View File

@@ -82,11 +82,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApiKey.cs" />
<Compile Include="BrowserUtil.cs" />
<Compile Include="CachedResult.cs" />
<Compile Include="ChannelInfo.cs" />
<Compile Include="ConfigurationData.cs" />
<Compile Include="ConfigurationDataBasicLoginAnimeBytes.cs" />
<Compile Include="ConfigurationDataBasicLogin.cs" />
<Compile Include="ConfigurationDataCookie.cs" />
<Compile Include="ConfigurationDataUrl.cs" />
<Compile Include="CookieContainerExtensions.cs" />
<Compile Include="DataUrl.cs" />
@@ -94,15 +95,19 @@
<Compile Include="HttpClientExtensions.cs" />
<Compile Include="IndexerInterface.cs" />
<Compile Include="IndexerManager.cs" />
<Compile Include="Indexers\BeyondHD.cs" />
<Compile Include="Indexers\BitHdtv.cs" />
<Compile Include="Indexers\BitMeTV.cs" />
<Compile Include="Indexers\Freshon.cs" />
<Compile Include="Indexers\HDTorrents.cs" />
<Compile Include="Indexers\IPTorrents.cs" />
<Compile Include="Indexers\MoreThanTV.cs" />
<Compile Include="Indexers\Rarbg.cs" />
<Compile Include="Indexers\SceneAccess.cs" />
<Compile Include="Indexers\SceneTime.cs" />
<Compile Include="Indexers\ShowRSS.cs" />
<Compile Include="Indexers\Strike.cs" />
<Compile Include="Indexers\T411.cs" />
<Compile Include="Indexers\ThePirateBay.cs" />
<Compile Include="Indexers\TorrentDay.cs" />
<Compile Include="Indexers\AnimeBytes.cs" />
@@ -162,12 +167,24 @@
<Content Include="WebContent\logos\animebytes.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="WebContent\logos\beyondhd.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="WebContent\logos\hdtorrents.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="WebContent\logos\sceneaccess.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="WebContent\logos\scenetime.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="WebContent\logos\showrss.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="WebContent\logos\t411.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="WebContent\logos\torrentday.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@@ -24,5 +24,21 @@ namespace Jackett
return long.Parse(str, NumberStyles.Any, CultureInfo.InvariantCulture);
}
public static bool TryCoerceFloat(string str, out float result)
{
return float.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
public static bool TryCoerceInt(string str, out int result)
{
return int.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
public static bool TryCoerceLong(string str, out long result)
{
return long.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
}
}

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyVersion("0.4.2.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -90,7 +90,9 @@ namespace Jackett
}
}
else
{
Program.LoggerInstance.FatalException("Failed to start HTTP server. " + ex.Message, ex);
}
}
catch (Exception ex)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB