diff --git a/src/Jackett.Common/Indexers/Shazbat.cs b/src/Jackett.Common/Indexers/Shazbat.cs index 7b7533bd4..cc4f5584f 100644 --- a/src/Jackett.Common/Indexers/Shazbat.cs +++ b/src/Jackett.Common/Indexers/Shazbat.cs @@ -33,9 +33,10 @@ namespace Jackett.Common.Indexers : base(name: "Shazbat", description: "Modern indexer", link: "https://www.shazbat.tv/", - caps: new TorznabCapabilities(TorznabCatType.TV, - TorznabCatType.TVHD, - TorznabCatType.TVSD), + caps: new TorznabCapabilities( + TorznabCatType.TV, + TorznabCatType.TVHD, + TorznabCatType.TVSD), configService: configService, client: c, logger: l, @@ -60,7 +61,6 @@ namespace Jackett.Common.Indexers }; // Get cookie - var firstRequest = await RequestStringWithCookiesAndRetry(LoginUrl); var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, null, true, null, LoginUrl); await ConfigureIfOK(result.Cookies, result.Content?.Contains("glyphicon-log-out") == true, () => throw new ExceptionWithConfigData("The username and password entered do not match.", configData)); @@ -74,29 +74,18 @@ namespace Jackett.Common.Indexers return IndexerConfigurationStatus.RequiresTesting; } - protected async Task ReloginIfNecessary(WebClientStringResult response) - { - if (!response.Content.Contains("onclick=\"document.location='logout'\"")) - { - await ApplyConfiguration(null); - response.Request.Cookies = CookieHeader; - return await webclient.GetString(response.Request); - } - - return response; - } - protected override async Task> PerformQuery(TorznabQuery query) { var releases = new List(); var queryString = query.GetQueryString(); - var url = TorrentsUrl; WebClientStringResult results = null; var searchUrls = new List(); if (!string.IsNullOrWhiteSpace(query.SanitizedSearchTerm)) { - var pairs = new Dictionary(); - pairs.Add("search", query.SanitizedSearchTerm); + var pairs = new Dictionary + { + {"search", query.SanitizedSearchTerm} + }; results = await PostDataWithCookiesAndRetry(SearchUrl, pairs, null, TorrentsUrl); results = await ReloginIfNecessary(results); var parser = new HtmlParser(); @@ -141,10 +130,10 @@ namespace Jackett.Common.Indexers release.BannerUrl = new Uri(SiteLink + bannerImg); } - var qLink = row.QuerySelector("td:nth-of-type(5) a:nth-of-type(1)"); + var qLink = row.QuerySelector("td:nth-of-type(5) a"); release.Link = new Uri(SiteLink + qLink.GetAttribute("href")); release.Guid = release.Link; - var qLinkComm = row.QuerySelector("td:nth-of-type(5) a:nth-of-type(2)"); + var qLinkComm = row.QuerySelector("td:nth-of-type(5) a.internal"); release.Comments = new Uri(SiteLink + qLinkComm.GetAttribute("href")); var dateString = row.QuerySelector(".datetime")?.GetAttribute("data-timestamp"); if (dateString != null) @@ -176,5 +165,15 @@ namespace Jackett.Common.Indexers : new List {TorznabCatType.TVSD.ID}; return releases; } + + private async Task ReloginIfNecessary(WebClientStringResult response) + { + if (response.Content.Contains("onclick=\"document.location='logout'\"")) + return response; + + await ApplyConfiguration(null); + response.Request.Cookies = CookieHeader; + return await webclient.GetString(response.Request); + } } }