From 8d8e9056a1f501892f5ce9f03c833bc37910cda1 Mon Sep 17 00:00:00 2001 From: snamds Date: Sun, 10 Feb 2019 01:41:50 +0100 Subject: [PATCH] Newpct - Redirect, link match (#4630) * btdb.to domain gone. using proxy https://btdb.unblocked.app/ until we're sure its not comming back. * katcrs: new domain plus followredirect * gktorrent: forcing https * - Allow download from mirrors (#4298) * HDTorrent.it (#4310) Update regex to handle better seasons and multiple episode Freelech torrent support Minor fix * IPTorrents: fix error handling * RoDVD: update URL * Torrent9 clone (torrents9.pw): update URL * TorrentCCF: update URL * - follow redirects - download link match changed --- src/Jackett.Common/Indexers/Newpct.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Jackett.Common/Indexers/Newpct.cs b/src/Jackett.Common/Indexers/Newpct.cs index ac58e178c..2d01f8a83 100644 --- a/src/Jackett.Common/Indexers/Newpct.cs +++ b/src/Jackett.Common/Indexers/Newpct.cs @@ -79,6 +79,7 @@ namespace Jackett.Common.Indexers private Regex _titleListRegex = new Regex(@"Serie( *Descargar)?(.+?)(Temporada(.+?)(\d+)(.+?))?Capitulos?(.+?)(\d+)((.+?)(\d+))?(.+?)-(.+?)Calidad(.*)", RegexOptions.IgnoreCase); private Regex _titleClassicRegex = new Regex(@"(\[[^\]]*\])?\[Cap\.(\d{1,2})(\d{2})([_-](\d{1,2})(\d{2}))?\]", RegexOptions.IgnoreCase); private Regex _titleClassicTvQualityRegex = new Regex(@"\[([^\]]*HDTV[^\]]*)", RegexOptions.IgnoreCase); + private Regex _downloadMatchRegex = new Regex("[^\"]*/descargar-torrent/[^\"]*"); private int _maxDailyPages = 7; private int _maxMoviesPages = 30; @@ -173,11 +174,11 @@ namespace Jackett.Common.Indexers try { - var results = await RequestStringWithCookies(link); + var results = await RequestStringWithCookiesAndRetry(link); + await FollowIfRedirect(results); var content = results.Content; - Regex regex = new Regex("[^\"]*/descargar-torrent/\\d+_[^\"]*"); - Match match = regex.Match(content); + Match match = _downloadMatchRegex.Match(content); if (match.Success) result = await base.Download(new Uri(match.Groups[0].Value)); } @@ -210,7 +211,8 @@ namespace Jackett.Common.Indexers while (pg <= _maxDailyPages) { Uri url = new Uri(siteLink, string.Format(_dailyUrl, pg)); - var results = await RequestStringWithCookies(url.AbsoluteUri); + var results = await RequestStringWithCookiesAndRetry(url.AbsoluteUri); + await FollowIfRedirect(results); var items = ParseDailyContent(results.Content); if (items == null || !items.Any()) @@ -328,7 +330,8 @@ namespace Jackett.Common.Indexers private async Task> GetReleasesFromUri(Uri uri, string seriesName) { var newpctReleases = new List(); - var results = await RequestStringWithCookies(uri.AbsoluteUri); + var results = await RequestStringWithCookiesAndRetry(uri.AbsoluteUri); + await FollowIfRedirect(results); //Episodes list string seriesEpisodesUrl = ParseSeriesListContent(results.Content, seriesName); @@ -338,7 +341,8 @@ namespace Jackett.Common.Indexers while (pg < _maxEpisodesListPages) { Uri episodesListUrl = new Uri(string.Format(_seriesUrl, seriesEpisodesUrl, pg)); - results = await RequestStringWithCookies(episodesListUrl.AbsoluteUri); + results = await RequestStringWithCookiesAndRetry(episodesListUrl.AbsoluteUri); + await FollowIfRedirect(results); var items = ParseEpisodesListContent(results.Content); if (items == null || !items.Any())