mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Implement Avistaz
This commit is contained in:
@@ -20,6 +20,7 @@ We were previously focused on TV but are working on extending searches to allow
|
|||||||
#### Supported Trackers
|
#### Supported Trackers
|
||||||
* [AlphaRatio](https://alpharatio.cc/)
|
* [AlphaRatio](https://alpharatio.cc/)
|
||||||
* [AnimeBytes](https://animebytes.tv/)
|
* [AnimeBytes](https://animebytes.tv/)
|
||||||
|
* [Avistaz](https://avistaz.to/)
|
||||||
* [BakaBT](http://bakabt.me/)
|
* [BakaBT](http://bakabt.me/)
|
||||||
* [bB](http://reddit.com/r/baconbits)
|
* [bB](http://reddit.com/r/baconbits)
|
||||||
* [BeyondHD](https://beyondhd.me/)
|
* [BeyondHD](https://beyondhd.me/)
|
||||||
|
BIN
src/Jackett/Content/logos/avistaz.png
Normal file
BIN
src/Jackett/Content/logos/avistaz.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
136
src/Jackett/Indexers/Abstract/AvistazTracker.cs
Normal file
136
src/Jackett/Indexers/Abstract/AvistazTracker.cs
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Jackett.Models;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using NLog;
|
||||||
|
using Jackett.Utils;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using CsQuery;
|
||||||
|
using System.Web;
|
||||||
|
using Jackett.Services;
|
||||||
|
using Jackett.Utils.Clients;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Jackett.Models.IndexerConfig;
|
||||||
|
|
||||||
|
namespace Jackett.Indexers
|
||||||
|
{
|
||||||
|
public abstract class AvistazTracker : BaseIndexer
|
||||||
|
{
|
||||||
|
private string LoginUrl { get { return SiteLink + "auth/login"; } }
|
||||||
|
private string SearchUrl { get { return SiteLink + "torrents?in=1&type={0}&search={1}"; } }
|
||||||
|
|
||||||
|
new ConfigurationDataBasicLogin configData
|
||||||
|
{
|
||||||
|
get { return (ConfigurationDataBasicLogin)base.configData; }
|
||||||
|
set { base.configData = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public AvistazTracker(IIndexerManagerService indexerManager, IWebClient webClient, Logger logger, IProtectionService protectionService, string name, string desc, string link)
|
||||||
|
: base(name: name,
|
||||||
|
description: desc,
|
||||||
|
link: link,
|
||||||
|
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
|
||||||
|
manager: indexerManager,
|
||||||
|
client: webClient,
|
||||||
|
logger: logger,
|
||||||
|
p: protectionService,
|
||||||
|
configData: new ConfigurationDataBasicLogin())
|
||||||
|
{
|
||||||
|
AddCategoryMapping(1, TorznabCatType.Movies);
|
||||||
|
AddCategoryMapping(1, TorznabCatType.MoviesForeign);
|
||||||
|
AddCategoryMapping(1, TorznabCatType.MoviesHD);
|
||||||
|
AddCategoryMapping(1, TorznabCatType.MoviesSD);
|
||||||
|
AddCategoryMapping(2, TorznabCatType.TV);
|
||||||
|
AddCategoryMapping(3, TorznabCatType.Audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
|
{
|
||||||
|
configData.LoadValuesFromJson(configJson);
|
||||||
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||||
|
var token = new Regex("Avz.CSRF_TOKEN = '(.*?)';").Match(loginPage.Content).Groups[1].ToString();
|
||||||
|
var pairs = new Dictionary<string, string> {
|
||||||
|
{ "_token", token },
|
||||||
|
{ "username_email", configData.Username.Value },
|
||||||
|
{ "password", configData.Password.Value },
|
||||||
|
{ "remember", "on" }
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, null, LoginUrl);
|
||||||
|
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("auth/logout"), () =>
|
||||||
|
{
|
||||||
|
CQ dom = result.Content;
|
||||||
|
var messageEl = dom[".form-error"];
|
||||||
|
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 categoryMapping = MapTorznabCapsToTrackers(query).Distinct();
|
||||||
|
string category = "0"; // Aka all
|
||||||
|
if (categoryMapping.Count() == 1)
|
||||||
|
{
|
||||||
|
category = categoryMapping.First();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var episodeSearchUrl = string.Format(SearchUrl, category, HttpUtility.UrlEncode(query.GetQueryString()));
|
||||||
|
|
||||||
|
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CQ dom = response.Content;
|
||||||
|
var rows = dom["table > tbody > tr"];
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
CQ qRow = row.Cq();
|
||||||
|
var release = new ReleaseInfo();
|
||||||
|
|
||||||
|
release.MinimumRatio = 1;
|
||||||
|
release.MinimumSeedTime = 172800;
|
||||||
|
|
||||||
|
var qLink = row.ChildElements.ElementAt(1).FirstElementChild.Cq();
|
||||||
|
release.Title = qLink.Text().Trim();
|
||||||
|
release.Comments = new Uri(qLink.Attr("href"));
|
||||||
|
release.Guid = release.Comments;
|
||||||
|
|
||||||
|
var qDownload = row.ChildElements.ElementAt(3).FirstElementChild.Cq();
|
||||||
|
release.Link = new Uri(qDownload.Attr("href"));
|
||||||
|
|
||||||
|
var dateStr = row.ChildElements.ElementAt(5).Cq().Text().Trim();
|
||||||
|
release.PublishDate = DateTimeUtil.FromTimeAgo(dateStr);
|
||||||
|
|
||||||
|
var sizeStr = row.ChildElements.ElementAt(6).Cq().Text();
|
||||||
|
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
||||||
|
|
||||||
|
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(8).Cq().Text());
|
||||||
|
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(9).Cq().Text()) + release.Seeders;
|
||||||
|
|
||||||
|
var cat = row.Cq().Find("td:eq(0) i").First().Attr("class")
|
||||||
|
.Replace("gi gi-film", "1")
|
||||||
|
.Replace("gi gi-tv", "2")
|
||||||
|
.Replace("gi gi-music", "3")
|
||||||
|
.Replace("text-pink", string.Empty);
|
||||||
|
release.Category = MapTrackerCatToNewznab(cat.Trim());
|
||||||
|
releases.Add(release);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
OnParseError(response.Content, ex);
|
||||||
|
}
|
||||||
|
return releases;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
src/Jackett/Indexers/Avistaz.cs
Normal file
35
src/Jackett/Indexers/Avistaz.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Jackett.Models;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using NLog;
|
||||||
|
using Jackett.Utils;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using CsQuery;
|
||||||
|
using System.Web;
|
||||||
|
using Jackett.Services;
|
||||||
|
using Jackett.Utils.Clients;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Jackett.Models.IndexerConfig;
|
||||||
|
|
||||||
|
namespace Jackett.Indexers
|
||||||
|
{
|
||||||
|
public class Avistaz : AvistazTracker, IIndexer
|
||||||
|
{
|
||||||
|
public Avistaz(IIndexerManagerService indexerManager, IWebClient webClient, Logger logger, IProtectionService protectionService)
|
||||||
|
: base(name: "Avistaz",
|
||||||
|
desc: "Aka AsiaTorrents",
|
||||||
|
link: "https://avistaz.to/",
|
||||||
|
indexerManager: indexerManager,
|
||||||
|
logger: logger,
|
||||||
|
protectionService: protectionService,
|
||||||
|
webClient: webClient
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -18,119 +18,18 @@ using Jackett.Models.IndexerConfig;
|
|||||||
|
|
||||||
namespace Jackett.Indexers
|
namespace Jackett.Indexers
|
||||||
{
|
{
|
||||||
public class PrivateHD : BaseIndexer, IIndexer
|
public class PrivateHD : AvistazTracker, IIndexer
|
||||||
{
|
{
|
||||||
private string LoginUrl { get { return SiteLink + "auth/login"; } }
|
public PrivateHD(IIndexerManagerService indexerManager, IWebClient webClient, Logger logger, IProtectionService protectionService)
|
||||||
private string SearchUrl { get { return SiteLink + "torrents?in=1&type={0}&search={1}"; } }
|
|
||||||
|
|
||||||
new ConfigurationDataBasicLogin configData
|
|
||||||
{
|
|
||||||
get { return (ConfigurationDataBasicLogin)base.configData; }
|
|
||||||
set { base.configData = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public PrivateHD(IIndexerManagerService i, IWebClient wc, Logger l, IProtectionService ps)
|
|
||||||
: base(name: "PrivateHD",
|
: base(name: "PrivateHD",
|
||||||
description: "BitTorrent site for High Quality, High Definition (HD) movies and TV Shows",
|
desc: "BitTorrent site for High Quality, High Definition (HD) movies and TV Shows",
|
||||||
link: "https://privatehd.to/",
|
link: "https://privatehd.to/",
|
||||||
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
|
indexerManager: indexerManager,
|
||||||
manager: i,
|
logger: logger,
|
||||||
client: wc,
|
protectionService: protectionService,
|
||||||
logger: l,
|
webClient: webClient
|
||||||
p: ps,
|
)
|
||||||
configData: new ConfigurationDataBasicLogin())
|
|
||||||
{
|
{
|
||||||
AddCategoryMapping(1, TorznabCatType.Movies);
|
|
||||||
AddCategoryMapping(1, TorznabCatType.MoviesForeign);
|
|
||||||
AddCategoryMapping(1, TorznabCatType.MoviesHD);
|
|
||||||
AddCategoryMapping(1, TorznabCatType.MoviesSD);
|
|
||||||
AddCategoryMapping(2, TorznabCatType.TV);
|
|
||||||
AddCategoryMapping(3, TorznabCatType.Audio);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
|
||||||
{
|
|
||||||
configData.LoadValuesFromJson(configJson);
|
|
||||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
|
||||||
var token = new Regex("Avz.CSRF_TOKEN = '(.*?)';").Match(loginPage.Content).Groups[1].ToString();
|
|
||||||
var pairs = new Dictionary<string, string> {
|
|
||||||
{ "_token", token },
|
|
||||||
{ "username_email", configData.Username.Value },
|
|
||||||
{ "password", configData.Password.Value },
|
|
||||||
{ "remember", "on" }
|
|
||||||
};
|
|
||||||
|
|
||||||
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, null, LoginUrl);
|
|
||||||
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("auth/logout"), () =>
|
|
||||||
{
|
|
||||||
CQ dom = result.Content;
|
|
||||||
var messageEl = dom[".form-error"];
|
|
||||||
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 categoryMapping = MapTorznabCapsToTrackers(query).Distinct();
|
|
||||||
string category = "0"; // Aka all
|
|
||||||
if (categoryMapping.Count() == 1)
|
|
||||||
{
|
|
||||||
category = categoryMapping.First();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var episodeSearchUrl = string.Format(SearchUrl, category, HttpUtility.UrlEncode(query.GetQueryString()));
|
|
||||||
|
|
||||||
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CQ dom = response.Content;
|
|
||||||
var rows = dom["table > tbody > tr"];
|
|
||||||
foreach (var row in rows)
|
|
||||||
{
|
|
||||||
CQ qRow = row.Cq();
|
|
||||||
var release = new ReleaseInfo();
|
|
||||||
|
|
||||||
release.MinimumRatio = 1;
|
|
||||||
release.MinimumSeedTime = 172800;
|
|
||||||
|
|
||||||
var qLink = row.ChildElements.ElementAt(1).FirstElementChild.Cq();
|
|
||||||
release.Title = qLink.Text().Trim();
|
|
||||||
release.Comments = new Uri(qLink.Attr("href"));
|
|
||||||
release.Guid = release.Comments;
|
|
||||||
|
|
||||||
var qDownload = row.ChildElements.ElementAt(3).FirstElementChild.Cq();
|
|
||||||
release.Link = new Uri(qDownload.Attr("href"));
|
|
||||||
|
|
||||||
var dateStr = row.ChildElements.ElementAt(5).Cq().Text().Trim();
|
|
||||||
release.PublishDate = DateTimeUtil.FromTimeAgo(dateStr);
|
|
||||||
|
|
||||||
var sizeStr = row.ChildElements.ElementAt(6).Cq().Text();
|
|
||||||
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
|
||||||
|
|
||||||
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(8).Cq().Text());
|
|
||||||
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(9).Cq().Text()) + release.Seeders;
|
|
||||||
|
|
||||||
var cat = row.Cq().Find("td:eq(0) i").First().Attr("class")
|
|
||||||
.Replace("gi gi-film", "1")
|
|
||||||
.Replace("gi gi-tv", "2")
|
|
||||||
.Replace("gi gi-music", "3")
|
|
||||||
.Replace("text-pink", string.Empty);
|
|
||||||
release.Category = MapTrackerCatToNewznab(cat.Trim());
|
|
||||||
releases.Add(release);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
OnParseError(response.Content, ex);
|
|
||||||
}
|
|
||||||
return releases;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -175,6 +175,7 @@
|
|||||||
<Compile Include="Controllers\DownloadController.cs" />
|
<Compile Include="Controllers\DownloadController.cs" />
|
||||||
<Compile Include="Engine.cs" />
|
<Compile Include="Engine.cs" />
|
||||||
<Compile Include="Indexers\AlphaRatio.cs" />
|
<Compile Include="Indexers\AlphaRatio.cs" />
|
||||||
|
<Compile Include="Indexers\Avistaz.cs" />
|
||||||
<Compile Include="Indexers\BakaBT.cs" />
|
<Compile Include="Indexers\BakaBT.cs" />
|
||||||
<Compile Include="Indexers\BaseIndexer.cs" />
|
<Compile Include="Indexers\BaseIndexer.cs" />
|
||||||
<Compile Include="Indexers\BB.cs" />
|
<Compile Include="Indexers\BB.cs" />
|
||||||
@@ -189,7 +190,8 @@
|
|||||||
<Compile Include="Indexers\IIndexer.cs" />
|
<Compile Include="Indexers\IIndexer.cs" />
|
||||||
<Compile Include="Indexers\ImmortalSeed.cs" />
|
<Compile Include="Indexers\ImmortalSeed.cs" />
|
||||||
<Compile Include="Indexers\FileList.cs" />
|
<Compile Include="Indexers\FileList.cs" />
|
||||||
<Compile Include="Indexers\ManualSearchResult.cs" />
|
<Compile Include="Indexers\Abstract\AvistazTracker.cs" />
|
||||||
|
<Compile Include="Models\ManualSearchResult.cs" />
|
||||||
<Compile Include="Indexers\Rarbg.cs" />
|
<Compile Include="Indexers\Rarbg.cs" />
|
||||||
<Compile Include="Indexers\TVChaosUK.cs" />
|
<Compile Include="Indexers\TVChaosUK.cs" />
|
||||||
<Compile Include="Indexers\NCore.cs" />
|
<Compile Include="Indexers\NCore.cs" />
|
||||||
@@ -405,6 +407,9 @@
|
|||||||
<Content Include="Content\logos\animebytes.png">
|
<Content Include="Content\logos\animebytes.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Content\logos\avistaz.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Content\logos\bakabt.png">
|
<Content Include="Content\logos\bakabt.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Jackett.Indexers
|
namespace Jackett
|
||||||
{
|
{
|
||||||
public class ManualSearchResult
|
public class ManualSearchResult
|
||||||
{
|
{
|
Reference in New Issue
Block a user