mirror of https://github.com/Jackett/Jackett
parent
07103a9eaf
commit
e940ac4c51
|
@ -8,7 +8,7 @@ using System.Text;
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Jackett.Common.Models;
|
||||
using Jackett.Common.Models.IndexerConfig;
|
||||
using Jackett.Common.Models.IndexerConfig.Bespoke;
|
||||
using Jackett.Common.Services.Interfaces;
|
||||
using Jackett.Common.Utils;
|
||||
using Jackett.Common.Utils.Clients;
|
||||
|
@ -20,14 +20,9 @@ namespace Jackett.Common.Indexers
|
|||
[ExcludeFromCodeCoverage]
|
||||
public class MyAnonamouse : BaseWebIndexer
|
||||
{
|
||||
private string LoginUrl => SiteLink + "takelogin.php";
|
||||
private string SearchUrl => SiteLink + "tor/js/loadSearchJSONbasic.php";
|
||||
|
||||
private new ConfigurationDataMyAnonamouse configData
|
||||
{
|
||||
get => (ConfigurationDataMyAnonamouse)base.configData;
|
||||
set => base.configData = value;
|
||||
}
|
||||
private new ConfigurationDataMyAnonamouse configData => (ConfigurationDataMyAnonamouse)base.configData;
|
||||
|
||||
public MyAnonamouse(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps)
|
||||
: base(id: "myanonamouse",
|
||||
|
@ -146,15 +141,12 @@ namespace Jackett.Common.Indexers
|
|||
{
|
||||
LoadValuesFromJson(configJson);
|
||||
|
||||
// TODO: implement captcha
|
||||
CookieHeader = "mam_id=" + configData.MamId.Value;
|
||||
try
|
||||
{
|
||||
var results = await PerformQuery(new TorznabQuery());
|
||||
if (results.Count() == 0)
|
||||
{
|
||||
if (!results.Any())
|
||||
throw new Exception("Your man_id did not work");
|
||||
}
|
||||
|
||||
IsConfigured = true;
|
||||
SaveConfig();
|
||||
|
@ -176,7 +168,7 @@ namespace Jackett.Common.Indexers
|
|||
{"tor[text]", query.GetQueryString()},
|
||||
{"tor[srchIn][title]", "true"},
|
||||
{"tor[srchIn][author]", "true"},
|
||||
{"tor[searchType]", "all"},
|
||||
{"tor[searchType]", configData.ExcludeVip?.Value == true ? "nVIP" : "all"}, // exclude VIP torrents
|
||||
{"tor[searchIn]", "torrents"},
|
||||
{"tor[hash]", ""},
|
||||
{"tor[sortType]", "default"},
|
||||
|
@ -184,10 +176,12 @@ namespace Jackett.Common.Indexers
|
|||
{"thumbnails", "1"}, // gives links for thumbnail sized versions of their posters
|
||||
//{ "posterLink", "1"}, // gives links for a full sized poster
|
||||
//{ "dlLink", "1"}, // include the url to download the torrent
|
||||
{"description", "1"}, // include the description
|
||||
{"description", "1"} // include the description
|
||||
//{"bookmarks", "0"} // include if the item is bookmarked or not
|
||||
};
|
||||
|
||||
// Exclude VIP torrents
|
||||
|
||||
var catList = MapTorznabCapsToTrackers(query);
|
||||
if (catList.Any())
|
||||
{
|
||||
|
@ -199,21 +193,15 @@ namespace Jackett.Common.Indexers
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qParams.Add("tor[cat][]", "0");
|
||||
}
|
||||
|
||||
var urlSearch = SearchUrl;
|
||||
if (qParams.Count > 0)
|
||||
{
|
||||
urlSearch += $"?{qParams.GetQueryString()}";
|
||||
}
|
||||
|
||||
var response = await RequestStringWithCookiesAndRetry(urlSearch);
|
||||
if (response.Content.StartsWith("Error"))
|
||||
{
|
||||
throw new Exception(response.Content);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -221,11 +209,8 @@ namespace Jackett.Common.Indexers
|
|||
var sitelink = new Uri(SiteLink);
|
||||
|
||||
var error = jsonContent.Value<string>("error");
|
||||
if (error != null)
|
||||
{
|
||||
if (error == "Nothing returned, out of 0")
|
||||
return releases;
|
||||
}
|
||||
if (error != null && error == "Nothing returned, out of 0")
|
||||
return releases;
|
||||
|
||||
foreach (var item in jsonContent.Value<JArray>("data"))
|
||||
{
|
||||
|
@ -237,22 +222,22 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
release.Description = item.Value<string>("description");
|
||||
|
||||
var author_info = item.Value<string>("author_info");
|
||||
var authorInfo = item.Value<string>("author_info");
|
||||
string author = null;
|
||||
if (!string.IsNullOrWhiteSpace(author_info))
|
||||
if (!string.IsNullOrWhiteSpace(authorInfo))
|
||||
{
|
||||
author_info = Regex.Unescape(author_info);
|
||||
var author_info_json = JObject.Parse(author_info);
|
||||
author = author_info_json.First.Last.Value<string>();
|
||||
authorInfo = Regex.Unescape(authorInfo);
|
||||
var authorInfoJson = JObject.Parse(authorInfo);
|
||||
author = authorInfoJson.First.Last.Value<string>();
|
||||
}
|
||||
if (author != null)
|
||||
release.Title += " by " + author;
|
||||
|
||||
var flags = new List<string>();
|
||||
|
||||
var lang_code = item.Value<string>("lang_code");
|
||||
if (!string.IsNullOrEmpty(lang_code))
|
||||
flags.Add(lang_code);
|
||||
var langCode = item.Value<string>("lang_code");
|
||||
if (!string.IsNullOrEmpty(langCode))
|
||||
flags.Add(langCode);
|
||||
|
||||
var filetype = item.Value<string>("filetype");
|
||||
if (!string.IsNullOrEmpty(filetype))
|
||||
|
@ -261,6 +246,9 @@ namespace Jackett.Common.Indexers
|
|||
if (flags.Count > 0)
|
||||
release.Title += " [" + string.Join(" / ", flags) + "]";
|
||||
|
||||
if (item.Value<int>("vip") == 1)
|
||||
release.Title += " [VIP]";
|
||||
|
||||
var category = item.Value<string>("category");
|
||||
release.Category = MapTrackerCatToNewznab(category);
|
||||
|
||||
|
@ -278,12 +266,8 @@ namespace Jackett.Common.Indexers
|
|||
release.Peers = item.Value<int>("leechers") + release.Seeders;
|
||||
var size = item.Value<string>("size");
|
||||
release.Size = ReleaseInfo.GetBytes(size);
|
||||
var free = item.Value<int>("free");
|
||||
|
||||
if (free == 1)
|
||||
release.DownloadVolumeFactor = 0;
|
||||
else
|
||||
release.DownloadVolumeFactor = 1;
|
||||
release.DownloadVolumeFactor = item.Value<int>("free") == 1 ? 0 : 1;
|
||||
release.UploadVolumeFactor = 1;
|
||||
|
||||
releases.Add(release);
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
namespace Jackett.Common.Models.IndexerConfig
|
||||
namespace Jackett.Common.Models.IndexerConfig.Bespoke
|
||||
{
|
||||
|
||||
public class ConfigurationDataMyAnonamouse : ConfigurationData
|
||||
{
|
||||
public StringItem MamId { get; private set; }
|
||||
public DisplayItem MamIdHint { get; private set; }
|
||||
public BoolItem ExcludeVip { get; private set; }
|
||||
public DisplayItem Instructions { get; private set; }
|
||||
|
||||
public ConfigurationDataMyAnonamouse()
|
||||
{
|
||||
|
@ -14,6 +16,8 @@ namespace Jackett.Common.Models.IndexerConfig
|
|||
{
|
||||
Name = "mam_id instructions"
|
||||
};
|
||||
ExcludeVip = new BoolItem { Name = "Exclude VIP torrents" };
|
||||
Instructions = new DisplayItem("For best results, change the 'Torrents per page' setting to 100 in your Profile => Torrent tab.") { Name = "" };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue