2020-02-09 02:35:16 +00:00
|
|
|
using System;
|
2016-03-27 13:50:02 +00:00
|
|
|
using System.Collections.Generic;
|
2017-10-29 06:21:18 +00:00
|
|
|
using System.Collections.Specialized;
|
2016-03-27 13:50:02 +00:00
|
|
|
using System.Globalization;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
2017-10-29 06:21:18 +00:00
|
|
|
using System.Threading;
|
2016-03-27 13:50:02 +00:00
|
|
|
using System.Threading.Tasks;
|
2020-02-29 18:32:35 +00:00
|
|
|
using AngleSharp.Html.Parser;
|
2018-03-10 08:05:56 +00:00
|
|
|
using Jackett.Common.Helpers;
|
|
|
|
using Jackett.Common.Models;
|
|
|
|
using Jackett.Common.Models.IndexerConfig;
|
|
|
|
using Jackett.Common.Services.Interfaces;
|
|
|
|
using Jackett.Common.Utils;
|
2017-10-29 06:21:18 +00:00
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using NLog;
|
2016-03-27 13:50:02 +00:00
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
namespace Jackett.Common.Indexers
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2017-07-10 20:58:44 +00:00
|
|
|
public class Fuzer : BaseWebIndexer
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2020-03-05 06:45:27 +00:00
|
|
|
public override string[] LegacySiteLinks { get; protected set; } =
|
|
|
|
{
|
|
|
|
"https://fuzer.me/"
|
2018-12-28 14:47:05 +00:00
|
|
|
};
|
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
private string SearchUrl => SiteLink + "browse.php";
|
|
|
|
private string LoginUrl => SiteLink + "login.php";
|
2016-03-27 13:50:02 +00:00
|
|
|
|
2018-06-23 08:26:02 +00:00
|
|
|
private new ConfigurationDataRecaptchaLogin configData
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2020-02-25 16:08:03 +00:00
|
|
|
get => (ConfigurationDataRecaptchaLogin)base.configData;
|
|
|
|
set => base.configData = value;
|
2016-03-27 13:50:02 +00:00
|
|
|
}
|
|
|
|
|
2017-11-05 09:42:03 +00:00
|
|
|
public Fuzer(IIndexerConfigurationService configService, Utils.Clients.WebClient w, Logger l, IProtectionService ps)
|
2016-03-27 13:50:02 +00:00
|
|
|
: base(name: "Fuzer",
|
2020-03-05 06:45:27 +00:00
|
|
|
description: "Fuzer is a private torrent website with israeli torrents.",
|
|
|
|
link: "https://www.fuzer.me/",
|
|
|
|
configService: configService,
|
|
|
|
client: w,
|
|
|
|
logger: l,
|
|
|
|
p: ps,
|
|
|
|
configData: new ConfigurationDataRecaptchaLogin())
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2017-11-05 09:42:03 +00:00
|
|
|
Encoding = Encoding.GetEncoding("windows-1255");
|
2016-12-09 17:20:58 +00:00
|
|
|
Language = "he-il";
|
2017-01-27 15:57:32 +00:00
|
|
|
Type = "private";
|
2019-05-11 03:27:25 +00:00
|
|
|
TorznabCaps.SupportsImdbMovieSearch = true;
|
2016-03-27 13:50:02 +00:00
|
|
|
TorznabCaps.Categories.Clear();
|
|
|
|
|
2017-10-24 16:30:09 +00:00
|
|
|
// סרטים
|
|
|
|
AddCategoryMapping(7, TorznabCatType.MoviesSD, "סרטים");
|
|
|
|
AddCategoryMapping(9, TorznabCatType.MoviesHD, "סרטים HD");
|
2019-08-13 05:00:00 +00:00
|
|
|
AddCategoryMapping(97, TorznabCatType.MoviesUHD, "סרטים UHD");
|
2017-10-24 16:30:09 +00:00
|
|
|
AddCategoryMapping(58, TorznabCatType.MoviesDVD, "סרטים DVD-R");
|
|
|
|
AddCategoryMapping(59, TorznabCatType.MoviesSD, "סרטי BDRIP-BRRip");
|
|
|
|
AddCategoryMapping(60, TorznabCatType.MoviesSD, "סרטים ישראליים");
|
|
|
|
AddCategoryMapping(61, TorznabCatType.MoviesHD, "סרטים ישראליים HD");
|
|
|
|
AddCategoryMapping(83, TorznabCatType.MoviesOther, "סרטים מדובבים");
|
|
|
|
|
|
|
|
// סדרות
|
|
|
|
AddCategoryMapping(8, TorznabCatType.TVSD, "סדרות");
|
|
|
|
AddCategoryMapping(10, TorznabCatType.TVHD, "סדרות HD");
|
|
|
|
AddCategoryMapping(62, TorznabCatType.TVSD, "סדרות ישראליות");
|
|
|
|
AddCategoryMapping(63, TorznabCatType.TVHD, "סדרות ישראליות HD");
|
|
|
|
AddCategoryMapping(84, TorznabCatType.TVOTHER, "סדרות מדובבות");
|
|
|
|
|
|
|
|
// מוזיקה
|
|
|
|
AddCategoryMapping(14, TorznabCatType.Audio, "מוזיקה עולמית");
|
|
|
|
AddCategoryMapping(66, TorznabCatType.Audio, "מוזיקה ישראלית");
|
|
|
|
AddCategoryMapping(67, TorznabCatType.AudioMP3, "FLAC");
|
|
|
|
AddCategoryMapping(68, TorznabCatType.Audio, "פסקולים");
|
|
|
|
|
|
|
|
// משחקים
|
|
|
|
AddCategoryMapping(11, TorznabCatType.PCGames, "משחקים PC");
|
|
|
|
AddCategoryMapping(12, TorznabCatType.ConsoleOther, "משחקים PS");
|
|
|
|
AddCategoryMapping(55, TorznabCatType.ConsoleXbox, "משחקים XBOX");
|
|
|
|
AddCategoryMapping(56, TorznabCatType.ConsoleWii, "משחקים WII");
|
|
|
|
AddCategoryMapping(57, TorznabCatType.PCPhoneOther, "משחקי קונסולות ניידות");
|
|
|
|
|
|
|
|
// תוכנה
|
|
|
|
AddCategoryMapping(13, TorznabCatType.PCPhoneAndroid, "אפליקציות לאנדרואיד");
|
|
|
|
AddCategoryMapping(15, TorznabCatType.PC0day, "תוכנות PC");
|
|
|
|
AddCategoryMapping(70, TorznabCatType.PCPhoneIOS, "אפליקציות לאייפון");
|
|
|
|
AddCategoryMapping(71, TorznabCatType.PCMac, "תוכנות MAC");
|
|
|
|
|
|
|
|
// שונות
|
|
|
|
AddCategoryMapping(16, TorznabCatType.XXX, "למבוגרים בלבד");
|
|
|
|
AddCategoryMapping(17, TorznabCatType.Other, "שונות");
|
|
|
|
AddCategoryMapping(64, TorznabCatType.Other, "ספורט");
|
|
|
|
AddCategoryMapping(65, TorznabCatType.Other, "אנימה");
|
|
|
|
AddCategoryMapping(69, TorznabCatType.Books, "Ebooks");
|
|
|
|
|
|
|
|
// FuzePacks
|
|
|
|
AddCategoryMapping(72, TorznabCatType.Console, "משחקים");
|
|
|
|
AddCategoryMapping(73, TorznabCatType.Movies, "סרטים");
|
|
|
|
AddCategoryMapping(74, TorznabCatType.PC, "תוכנות");
|
|
|
|
AddCategoryMapping(75, TorznabCatType.Audio, "שירים");
|
|
|
|
AddCategoryMapping(76, TorznabCatType.TV, "סדרות");
|
2016-03-27 13:50:02 +00:00
|
|
|
}
|
|
|
|
|
2018-06-23 08:26:02 +00:00
|
|
|
public override async Task<ConfigurationData> GetConfigurationForSetup()
|
|
|
|
{
|
|
|
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
2020-02-29 18:32:35 +00:00
|
|
|
var parser = new HtmlParser();
|
|
|
|
var cq = parser.ParseDocument(loginPage.Content);
|
|
|
|
var captcha = cq.QuerySelector(".g-recaptcha"); // invisible recaptcha
|
|
|
|
if (captcha != null)
|
2018-06-23 08:26:02 +00:00
|
|
|
{
|
2020-02-10 22:16:19 +00:00
|
|
|
var result = configData;
|
2018-06-23 08:26:02 +00:00
|
|
|
result.CookieHeader.Value = loginPage.Cookies;
|
2020-02-29 18:32:35 +00:00
|
|
|
result.Captcha.SiteKey = captcha.GetAttribute("data-sitekey");
|
2018-06-23 08:26:02 +00:00
|
|
|
result.Captcha.Version = "2";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var result = new ConfigurationDataBasicLogin();
|
|
|
|
result.SiteLink.Value = configData.SiteLink.Value;
|
|
|
|
result.Instructions.Value = configData.Instructions.Value;
|
|
|
|
result.Username.Value = configData.Username.Value;
|
|
|
|
result.Password.Value = configData.Password.Value;
|
|
|
|
result.CookieHeader.Value = loginPage.Cookies;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-28 05:31:38 +00:00
|
|
|
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2017-01-02 20:39:28 +00:00
|
|
|
LoadValuesFromJson(configJson);
|
2018-06-23 08:26:02 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(configData.Captcha.Cookie))
|
|
|
|
{
|
|
|
|
CookieHeader = configData.Captcha.Cookie;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
var results = await PerformQuery(new TorznabQuery());
|
2020-03-05 06:45:27 +00:00
|
|
|
if (!results.Any())
|
2018-06-23 08:26:02 +00:00
|
|
|
throw new Exception("Your cookie did not work");
|
|
|
|
IsConfigured = true;
|
|
|
|
SaveConfig();
|
|
|
|
return IndexerConfigurationStatus.Completed;
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
IsConfigured = false;
|
|
|
|
throw new Exception("Your cookie did not work: " + e.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-27 13:50:02 +00:00
|
|
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
2020-03-05 06:45:27 +00:00
|
|
|
var pairs = new Dictionary<string, string>
|
|
|
|
{
|
|
|
|
{"vb_login_username", configData.Username.Value},
|
|
|
|
{"vb_login_password", ""},
|
|
|
|
{"securitytoken", "guest"},
|
|
|
|
{"do", "login"},
|
|
|
|
{"vb_login_md5password", StringUtil.Hash(configData.Password.Value).ToLower()},
|
|
|
|
{"vb_login_md5password_utf", StringUtil.Hash(configData.Password.Value).ToLower()},
|
|
|
|
{"cookieuser", "1"}
|
2016-03-27 13:50:02 +00:00
|
|
|
};
|
|
|
|
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, null, LoginUrl);
|
2020-03-05 06:45:27 +00:00
|
|
|
await ConfigureIfOK(result.Cookies, result.Content?.Contains("images/loading.gif") == true,
|
|
|
|
() => throw new ExceptionWithConfigData("Couldn't login", configData));
|
2016-03-27 13:50:02 +00:00
|
|
|
Thread.Sleep(2);
|
|
|
|
return IndexerConfigurationStatus.RequiresTesting;
|
|
|
|
}
|
|
|
|
|
2017-07-03 05:15:47 +00:00
|
|
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2020-03-05 06:45:27 +00:00
|
|
|
var results = await PerformRegularQueryAsync(query);
|
|
|
|
if (!results.Any() && !query.IsImdbQuery)
|
|
|
|
return await PerformHebrewQueryAsync(query);
|
2016-03-27 13:50:02 +00:00
|
|
|
return results;
|
|
|
|
}
|
|
|
|
|
2020-03-05 06:45:27 +00:00
|
|
|
private async Task<IEnumerable<ReleaseInfo>> PerformHebrewQueryAsync(TorznabQuery query)
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2020-03-05 06:45:27 +00:00
|
|
|
var name = await GetHebNameAsync(query.SearchTerm);
|
2016-03-27 13:50:02 +00:00
|
|
|
if (string.IsNullOrEmpty(name))
|
|
|
|
return new List<ReleaseInfo>();
|
2020-03-05 06:45:27 +00:00
|
|
|
return await PerformRegularQueryAsync(query, name);
|
2016-03-27 13:50:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-05 06:45:27 +00:00
|
|
|
private async Task<IEnumerable<ReleaseInfo>> PerformRegularQueryAsync(TorznabQuery query, string hebName = null)
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
|
|
|
var releases = new List<ReleaseInfo>();
|
|
|
|
var searchUrl = SearchUrl;
|
|
|
|
var searchString = query.GetQueryString();
|
2018-01-23 19:51:10 +00:00
|
|
|
if (query.IsImdbQuery)
|
|
|
|
searchString = query.ImdbID;
|
2016-03-27 13:50:02 +00:00
|
|
|
if (hebName != null)
|
|
|
|
searchString = hebName + " - עונה " + query.Season + " פרק " + query.Episode;
|
2017-10-24 16:30:09 +00:00
|
|
|
searchUrl += "?";
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchString))
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2017-11-05 09:42:03 +00:00
|
|
|
var strEncoded = WebUtilityHelpers.UrlEncode(searchString, Encoding);
|
2017-10-24 16:30:09 +00:00
|
|
|
searchUrl += "&query=" + strEncoded + "&matchquery=any";
|
2016-03-27 13:50:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-05 06:45:27 +00:00
|
|
|
searchUrl = MapTorznabCapsToTrackers(query).Aggregate(searchUrl, (current, cat) => $"{current}&c[]={cat}");
|
2016-12-06 13:56:47 +00:00
|
|
|
var data = await RequestStringWithCookiesAndRetry(searchUrl);
|
2016-03-27 13:50:02 +00:00
|
|
|
try
|
|
|
|
{
|
2020-02-29 18:32:35 +00:00
|
|
|
var parser = new HtmlParser();
|
|
|
|
var dom = parser.ParseDocument(data.Content);
|
|
|
|
var rows = dom.QuerySelectorAll("tr.box_torrent");
|
2016-03-27 13:50:02 +00:00
|
|
|
foreach (var row in rows)
|
|
|
|
{
|
2017-10-24 16:30:09 +00:00
|
|
|
var release = new ReleaseInfo();
|
2020-03-05 06:45:27 +00:00
|
|
|
var mainTitleLink = row.QuerySelector("div.main_title > a");
|
|
|
|
release.Title = mainTitleLink.GetAttribute("longtitle");
|
|
|
|
if (string.IsNullOrWhiteSpace(release.Title))
|
|
|
|
release.Title = mainTitleLink.TextContent;
|
2016-03-27 13:50:02 +00:00
|
|
|
release.MinimumRatio = 1;
|
2020-01-11 18:07:19 +00:00
|
|
|
release.MinimumSeedTime = 172800; // 48 hours
|
2020-02-29 18:32:35 +00:00
|
|
|
release.Grabs = ParseUtil.CoerceLong(row.QuerySelector("td:nth-child(5)").TextContent.Replace(",", ""));
|
|
|
|
release.Seeders = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(6)").TextContent.Replace(",", ""));
|
2020-03-05 06:45:27 +00:00
|
|
|
release.Peers = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(7)").TextContent.Replace(",", "")) +
|
|
|
|
release.Seeders;
|
2020-02-29 18:32:35 +00:00
|
|
|
var fullSize = row.QuerySelector("td:nth-child(4)").TextContent;
|
2016-03-27 13:50:02 +00:00
|
|
|
release.Size = ReleaseInfo.GetBytes(fullSize);
|
2020-02-29 18:32:35 +00:00
|
|
|
release.Comments = new Uri(SiteLink + row.QuerySelector("a.threadlink[href]").GetAttribute("href"));
|
|
|
|
release.Link = new Uri(SiteLink + row.QuerySelector("a:has(div.dlimg)").GetAttribute("href"));
|
2017-10-24 16:30:09 +00:00
|
|
|
release.Guid = release.Comments;
|
2020-03-05 06:45:27 +00:00
|
|
|
//some releases have invalid banner URLs, ignore the banners in this case
|
|
|
|
if (Uri.TryCreate(row.QuerySelector("a[imgsrc]").GetAttribute("imgsrc"),
|
|
|
|
UriKind.Absolute, out var banner))
|
|
|
|
release.BannerUrl = banner;
|
2020-03-06 04:21:28 +00:00
|
|
|
var dateStringAll = row.QuerySelector("div.up_info2").ChildNodes.Last().TextContent;
|
2017-10-24 16:30:09 +00:00
|
|
|
var dateParts = dateStringAll.Split(' ');
|
2020-02-10 22:16:19 +00:00
|
|
|
var dateString = dateParts[dateParts.Length - 2] + " " + dateParts[dateParts.Length - 1];
|
2017-10-24 16:30:09 +00:00
|
|
|
release.PublishDate = DateTime.ParseExact(dateString, "dd/MM/yy HH:mm", CultureInfo.InvariantCulture);
|
2020-02-29 18:32:35 +00:00
|
|
|
var categoryLink = row.QuerySelector("a[href^=\"/browse.php?cat=\"]").GetAttribute("href");
|
2017-10-24 16:30:09 +00:00
|
|
|
var catid = ParseUtil.GetArgumentFromQueryString(categoryLink, "cat");
|
|
|
|
release.Category = MapTrackerCatToNewznab(catid);
|
2020-02-29 18:32:35 +00:00
|
|
|
if (row.QuerySelector("a[href^=\"?freeleech=1\"]") != null)
|
2017-04-15 08:45:10 +00:00
|
|
|
release.DownloadVolumeFactor = 0;
|
2016-10-27 07:35:31 +00:00
|
|
|
else
|
|
|
|
release.DownloadVolumeFactor = 1;
|
|
|
|
release.UploadVolumeFactor = 1;
|
2020-03-05 06:45:27 +00:00
|
|
|
var subTitle = row.QuerySelector("div.sub_title");
|
|
|
|
var imdbLink = subTitle.QuerySelector("span.imdb-inline > a");
|
|
|
|
if (imdbLink != null)
|
|
|
|
release.Imdb = ParseUtil.GetLongFromString(imdbLink.GetAttribute("href"));
|
|
|
|
release.Description = subTitle.FirstChild.TextContent;
|
2016-03-27 13:50:02 +00:00
|
|
|
releases.Add(release);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2016-12-06 13:56:47 +00:00
|
|
|
OnParseError(data.Content, ex);
|
2016-03-27 13:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return releases;
|
|
|
|
}
|
|
|
|
|
2020-03-05 06:45:27 +00:00
|
|
|
private async Task<string> GetHebNameAsync(string searchTerm)
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2020-03-05 06:45:27 +00:00
|
|
|
var queryString = new NameValueCollection
|
|
|
|
{
|
|
|
|
{"searchseriesid", ""},
|
2020-03-06 04:21:28 +00:00
|
|
|
{"tab", "listseries"},
|
|
|
|
{"function", "Search"},
|
|
|
|
{"string", searchTerm}, // eretz + nehedert
|
2020-03-05 06:45:27 +00:00
|
|
|
};
|
|
|
|
var site = new UriBuilder
|
|
|
|
{
|
|
|
|
Scheme = "http",
|
|
|
|
Host = "thetvdb.com",
|
|
|
|
Path = "index.php",
|
|
|
|
Query = queryString.GetQueryString()
|
|
|
|
};
|
|
|
|
var results = await RequestStringWithCookies(site.ToString());
|
2020-02-29 18:32:35 +00:00
|
|
|
var parser = new HtmlParser();
|
|
|
|
var dom = parser.ParseDocument(results.Content);
|
|
|
|
var rows = dom.QuerySelectorAll("#listtable > tbody > tr");
|
2020-03-05 06:45:27 +00:00
|
|
|
foreach (var row in rows.Skip(1))
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2020-02-29 18:32:35 +00:00
|
|
|
var link = row.QuerySelector("td:nth-child(1) > a");
|
2020-03-05 06:45:27 +00:00
|
|
|
if (string.Equals(link.TextContent.Trim(), searchTerm.Trim(), StringComparison.CurrentCultureIgnoreCase))
|
2016-03-27 13:50:02 +00:00
|
|
|
{
|
2020-02-29 18:32:35 +00:00
|
|
|
var address = link.GetAttribute("href");
|
2020-02-09 02:35:16 +00:00
|
|
|
if (string.IsNullOrEmpty(address))
|
2020-03-05 06:45:27 +00:00
|
|
|
continue;
|
2020-02-29 18:32:35 +00:00
|
|
|
var realDom = parser.ParseDocument(results.Content);
|
|
|
|
return realDom.QuerySelector("#content:nth-child(1) > h1").TextContent;
|
2016-03-27 13:50:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return string.Empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|