From 676d03eb885fdbc8f1daa47cd960afbb7414acec Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 14 Jun 2018 17:28:57 +0200 Subject: [PATCH 01/13] mono: redirect workaround --- src/Jackett.Common/Utils/Clients/HttpWebClient.cs | 6 +++++- src/Jackett.Common/Utils/Clients/HttpWebClient2.cs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Utils/Clients/HttpWebClient.cs b/src/Jackett.Common/Utils/Clients/HttpWebClient.cs index ca878a901..c2c77dff0 100644 --- a/src/Jackett.Common/Utils/Clients/HttpWebClient.cs +++ b/src/Jackett.Common/Utils/Clients/HttpWebClient.cs @@ -13,6 +13,7 @@ using CloudFlareUtilities; using Jackett.Common.Models.Config; using Jackett.Common.Services.Interfaces; using NLog; +using Jackett.Common.Helpers; namespace Jackett.Common.Utils.Clients { @@ -257,7 +258,10 @@ namespace Jackett.Common.Utils.Clients // See issue #1200 if (result.RedirectingTo != null && result.RedirectingTo.StartsWith("file://")) { - var newRedirectingTo = result.RedirectingTo.Replace("file://", request.RequestUri.Scheme + "://" + request.RequestUri.Host); + // URL decoding apparently is needed to, without it e.g. Demonoid download is broken + // TODO: is it always needed (not just for relative redirects)? + var newRedirectingTo = WebUtilityHelpers.UrlDecode(result.RedirectingTo, webRequest.Encoding); + newRedirectingTo = newRedirectingTo.Replace("file://", request.RequestUri.Scheme + "://" + request.RequestUri.Host); logger.Debug("[MONO relative redirect bug] Rewriting relative redirect URL from " + result.RedirectingTo + " to " + newRedirectingTo); result.RedirectingTo = newRedirectingTo; } diff --git a/src/Jackett.Common/Utils/Clients/HttpWebClient2.cs b/src/Jackett.Common/Utils/Clients/HttpWebClient2.cs index b0217b179..d2dc42afd 100644 --- a/src/Jackett.Common/Utils/Clients/HttpWebClient2.cs +++ b/src/Jackett.Common/Utils/Clients/HttpWebClient2.cs @@ -13,6 +13,7 @@ using CloudFlareUtilities; using Jackett.Common.Models.Config; using Jackett.Common.Services.Interfaces; using NLog; +using Jackett.Common.Helpers; namespace Jackett.Common.Utils.Clients { @@ -277,7 +278,10 @@ namespace Jackett.Common.Utils.Clients // See issue #1200 if (result.RedirectingTo != null && result.RedirectingTo.StartsWith("file://")) { - var newRedirectingTo = result.RedirectingTo.Replace("file://", request.RequestUri.Scheme + "://" + request.RequestUri.Host); + // URL decoding apparently is needed to, without it e.g. Demonoid download is broken + // TODO: is it always needed (not just for relative redirects)? + var newRedirectingTo = WebUtilityHelpers.UrlDecode(result.RedirectingTo, webRequest.Encoding); + newRedirectingTo = newRedirectingTo.Replace("file://", request.RequestUri.Scheme + "://" + request.RequestUri.Host); logger.Debug("[MONO relative redirect bug] Rewriting relative redirect URL from " + result.RedirectingTo + " to " + newRedirectingTo); result.RedirectingTo = newRedirectingTo; } From 2d4f7ab0e9721b996f331ed0e8f52a2dd1efe7a5 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 14 Jun 2018 17:39:16 +0200 Subject: [PATCH 02/13] Waffles: fix category parsing --- src/Jackett.Common/Definitions/waffles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Jackett.Common/Definitions/waffles.yml b/src/Jackett.Common/Definitions/waffles.yml index 930e408d7..91c1ca124 100644 --- a/src/Jackett.Common/Definitions/waffles.yml +++ b/src/Jackett.Common/Definitions/waffles.yml @@ -120,7 +120,7 @@ selector: table#browsetable > tbody > tr:has(a[href^="/details.php?id="]) fields: category: - selector: a[href^="/browse.php?q="] + selector: a[href^="/browse.php"] attribute: href filters: - name: querystring From c998ba376239c5080e690e4c4786aa836b94566f Mon Sep 17 00:00:00 2001 From: morpheus133 Date: Thu, 14 Jun 2018 17:44:22 +0200 Subject: [PATCH 03/13] Additional fix for #1450 (#3227) * Additional fix for #1450 Sonarr is search for a tilte if the result title is different it reject it. So it is not enough that Jackett give the result it must give with the same language. Workaround create a new title from the original one and from the title. It also make some fine tunning: if title not contains the language we add it from category * Make decision safer --- src/Jackett.Common/Indexers/NCore.cs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/NCore.cs b/src/Jackett.Common/Indexers/NCore.cs index 9b0e94557..96d1baf3f 100644 --- a/src/Jackett.Common/Indexers/NCore.cs +++ b/src/Jackett.Common/Indexers/NCore.cs @@ -208,9 +208,35 @@ namespace Jackett.Common.Indexers else { - Match m = Regex.Match(release.Title, @""+ seasonep + @"\s?$", RegexOptions.IgnoreCase); if (query.MatchQueryStringAND(release.Title, null, seasonep)) { + /* For sonnar if the search querry was english the title must be english also so we need to change the Description and Title */ + var temp = release.Title; + + // releasedata everithing after Name.S0Xe0X + String releasedata =release.Title.Split(new[] { seasonep }, StringSplitOptions.None)[1].Trim(); + + /* if the release name not contains the language we add it because it is know from category */ + if (cat.Contains("hun") && !releasedata.Contains("hun")) + releasedata += ".hun"; + + // release description contains [imdb: ****] but we only need the data before it for title + String[] description = {"",""}; + if (release.Description.Contains("[imdb:")) + { + description = release.Description.Split('['); + description[1] = "[" + description[1]; + } + + release.Title = (description[0].Trim() + "." + seasonep.Trim() + "." + releasedata.Trim('.')).Replace(' ', '.'); + + // if search is done for S0X than we dont want to put . between S0X and E0X + Match match = Regex.Match(releasedata, @"^E\d\d?"); + if (seasonep.Length==3 && match.Success) + release.Title = (description[0].Trim() + "." + seasonep.Trim() + releasedata.Trim('.')).Replace(' ', '.'); + + // add back imdb points to the description [imdb: 8.7] + release.Description = temp+" "+ description[1]; releases.Add(release); } } From 5ee6833610d04d4cce014ec40865f61c48cd938f Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 14 Jun 2018 17:53:46 +0200 Subject: [PATCH 04/13] NCore: fix else --- src/Jackett.Common/Indexers/NCore.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/NCore.cs b/src/Jackett.Common/Indexers/NCore.cs index 96d1baf3f..aed1f7edb 100644 --- a/src/Jackett.Common/Indexers/NCore.cs +++ b/src/Jackett.Common/Indexers/NCore.cs @@ -221,12 +221,13 @@ namespace Jackett.Common.Indexers releasedata += ".hun"; // release description contains [imdb: ****] but we only need the data before it for title - String[] description = {"",""}; + String[] description = {release.Description, ""}; if (release.Description.Contains("[imdb:")) { description = release.Description.Split('['); description[1] = "[" + description[1]; } + else release.Title = (description[0].Trim() + "." + seasonep.Trim() + "." + releasedata.Trim('.')).Replace(' ', '.'); @@ -237,6 +238,7 @@ namespace Jackett.Common.Indexers // add back imdb points to the description [imdb: 8.7] release.Description = temp+" "+ description[1]; + release.Description = release.Description.Trim(); releases.Add(release); } } From b48dd5e930fdb544a58fe6ccdeb358b2bef4e9fc Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 14 Jun 2018 18:38:07 +0200 Subject: [PATCH 05/13] cpasbien: URL update --- src/Jackett.Common/Definitions/cpabien.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Definitions/cpabien.yml b/src/Jackett.Common/Definitions/cpabien.yml index 467f49826..c600d0464 100644 --- a/src/Jackett.Common/Definitions/cpabien.yml +++ b/src/Jackett.Common/Definitions/cpabien.yml @@ -6,8 +6,9 @@ type: public encoding: UTF-8 links: - - http://www.cpabien.cm/ + - http://www.cpasbiens.cc/ legacylinks: + - http://www.cpabien.cm/ - http://cpabien.cm/ - http://cpasbiens1.com/ - http://cpabien.mx/ From 687e6e237fc3e65f52a84be437c29f8bd62bc777 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 14 Jun 2018 19:28:36 +0200 Subject: [PATCH 06/13] TorrentWTF: removed (dead) --- README.md | 1 - src/Jackett.Common/Definitions/torrentwtf.yml | 111 ------------------ src/Jackett.Updater/Program.cs | 1 + 3 files changed, 1 insertion(+), 112 deletions(-) delete mode 100644 src/Jackett.Common/Definitions/torrentwtf.yml diff --git a/README.md b/README.md index 2ef247b4c..d17518584 100644 --- a/README.md +++ b/README.md @@ -272,7 +272,6 @@ Developer note: The software implements the [Torznab](https://github.com/Sonarr/ * TorrentSeeds * Torrent-Syndikat * TOrrent-tuRK (TORK) - * TorrentWTF * TorViet * ToTheGlory * TranceTraffic diff --git a/src/Jackett.Common/Definitions/torrentwtf.yml b/src/Jackett.Common/Definitions/torrentwtf.yml deleted file mode 100644 index af56fd381..000000000 --- a/src/Jackett.Common/Definitions/torrentwtf.yml +++ /dev/null @@ -1,111 +0,0 @@ ---- - site: torrentwtf - name: Torrentwtf - description: "Torrentwtf is a Czech Private site for TV / MOVIES / GENERAL" - language: cs-cz - type: private - encoding: UTF-8 - links: - - https://torrent.wtf/ - - caps: - categorymappings: - - {id: 1, cat: Movies, desc: "Filmy"} - - {id: 2, cat: TV, desc: "Seriály"} - - {id: 3, cat: Audio, desc: "Hudba"} - - {id: 5, cat: PC/Games, desc: "Hry"} - - {id: 6, cat: Books, desc: "Knihy"} - - {id: 8, cat: PC, desc: "Software"} - - {id: 9, cat: XXX, desc: "xXx"} - - {id: 10, cat: Other, desc: "Ostatní"} - - modes: - search: [q] - tv-search: [q, season, ep, imdbid] - movie-search: [q, imdbid] - - login: - path: /login - method: form - inputs: - username: "{{ .Config.username }}" - password: "{{ .Config.password }}" - error: - - selector: table.main:contains("Tieto poverenia sa nezhodujú s našimi záznamami.") - test: - path: /torrents - - search: - paths: - - path: /filter - inputs: - $raw: "{{range .Categories}}categories[]={{.}}&{{end}}" - search: "{{if .Query.IMDBID}}{{else}}{{ .Keywords }}{{end}}" - imdb: "{{ .Query.IMDBIDShort }}" - tvdb: "" - tmdb: "" - sorting: created_at - direction: desc - qty: 100 - preprocessingfilters: - - name: jsonjoinarray - args: ["$.result", ""] - - name: prepend - args: "" - - name: append - args: "
" - rows: - selector: tr - fields: - category: - selector: a[href*="/categories/"] - attribute: href - filters: - - name: regexp - args: "/categories/.*?\\.(\\d+)" - title: - selector: a.view-torrent - filters: - - name: re_replace - args: [".*? / ", ""] - download: - selector: a[href*="/download_check/"] - attribute: href - filters: - - name: replace - args: ["/download_check/", "/download/"] - details: - selector: a.view-torrent - attribute: href - imdb: - optional: true - selector: a[href*="://www.imdb.com/title/"] - attribute: href - size: - selector: td:nth-child(5) - seeders: - selector: td:nth-child(7) - leechers: - selector: td:nth-child(8) - grabs: - selector: td:nth-child(6) - filters: - - name: regexp - args: ([\d\.]+) - date: - selector: time - attribute: datetime - filters: - - name: append - args: " +00:00" - - name: dateparse - args: "2006-01-02 15:04:05 -07:00" - downloadvolumefactor: - case: - "i[data-original-title=\"100% Free\"]": "0" - "i[data-original-title=\"Global FreeLeech\"]": "0" - "*": "1" - uploadvolumefactor: - case: - "i[data-original-title=\"Double upload\"]": "2" - "*": "1" \ No newline at end of file diff --git a/src/Jackett.Updater/Program.cs b/src/Jackett.Updater/Program.cs index dbe68baec..babe31a9d 100644 --- a/src/Jackett.Updater/Program.cs +++ b/src/Jackett.Updater/Program.cs @@ -206,6 +206,7 @@ namespace Jackett.Updater "Definitions/rockhardlossless.yml", "Definitions/oxtorrent.yml", "Definitions/tehconnection.yml", + "Definitions/torrentwtf.yml", }; foreach (var oldFIle in oldFiles) From aee64aa5894139e8159c5a44f22e5cf77b6bc138 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 14 Jun 2018 19:28:51 +0200 Subject: [PATCH 07/13] Shareisland: update URL --- src/Jackett.Common/Definitions/shareisland.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Definitions/shareisland.yml b/src/Jackett.Common/Definitions/shareisland.yml index aeb30d21b..4bfddd92f 100644 --- a/src/Jackett.Common/Definitions/shareisland.yml +++ b/src/Jackett.Common/Definitions/shareisland.yml @@ -6,8 +6,9 @@ type: private encoding: UTF-8 links: - - http://shareisland.org/ + - https://shareisland.org/ legacylinks: + - http://shareisland.org/ - http://www.shareisland.org/ caps: From 67b18352644d553956b236fba15322c43ec2823f Mon Sep 17 00:00:00 2001 From: kaso17 Date: Fri, 15 Jun 2018 10:30:43 +0200 Subject: [PATCH 08/13] Bit-City Reloaded: fix login --- src/Jackett.Common/Indexers/BitCityReloaded.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/BitCityReloaded.cs b/src/Jackett.Common/Indexers/BitCityReloaded.cs index 838a2b98c..48f6f5bff 100644 --- a/src/Jackett.Common/Indexers/BitCityReloaded.cs +++ b/src/Jackett.Common/Indexers/BitCityReloaded.cs @@ -17,7 +17,7 @@ namespace Jackett.Common.Indexers { public class BitCityReloaded : BaseWebIndexer { - private string LoginUrl { get { return SiteLink + "login.php"; } } + private string LoginUrl { get { return SiteLink + "login/index.php"; } } private string BrowseUrl { get { return SiteLink + "uebersicht.php"; } } private TimeZoneInfo germanyTz = TimeZoneInfo.CreateCustomTimeZone("W. Europe Standard Time", new TimeSpan(1, 0, 0), "W. Europe Standard Time", "W. Europe Standard Time"); From ec4afda1849249f04ae995501c7f65b7e1c66f1d Mon Sep 17 00:00:00 2001 From: kaso17 Date: Fri, 15 Jun 2018 10:44:26 +0200 Subject: [PATCH 09/13] Audiobook Torrents: improve compatibility --- .../Definitions/audiobooktorrents.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Jackett.Common/Definitions/audiobooktorrents.yml b/src/Jackett.Common/Definitions/audiobooktorrents.yml index d8c40e7e2..909b40abb 100644 --- a/src/Jackett.Common/Definitions/audiobooktorrents.yml +++ b/src/Jackett.Common/Definitions/audiobooktorrents.yml @@ -72,7 +72,7 @@ rows: selector: tr.browse_color, tr.freeleech_color, tr[id^="kdescr"] after: 1 - fields: + fields: # some users (rank specific?) have an extra column (td:nth-child(4)) with bookmark features banner: selector: a[href^="details.php?id="][onmouseover] attribute: onmouseover @@ -98,20 +98,20 @@ selector: a[href^="download.php"] attribute: href files: - selector: td:nth-child(4) + selector: a[href^="filelist.php"] size: - selector: td:nth-child(7) + selector: td:nth-last-child(6) grabs: - selector: td:nth-child(8) + selector: td:nth-last-child(5) filters: - name: regexp args: ([\d,]+) seeders: - selector: td:nth-child(9) + selector: td:nth-last-child(4) leechers: - selector: td:nth-child(10) + selector: td:nth-last-child(3) date: - selector: td:nth-child(6) + selector: td:nth-last-child(7) downloadvolumefactor: case: "a.info > b:contains(\"[FREE]\")": "0" From 3468e7d40428f88537015096ed014d5d1bb8844e Mon Sep 17 00:00:00 2001 From: kaso17 Date: Fri, 15 Jun 2018 11:12:03 +0200 Subject: [PATCH 10/13] improve BEncode error handling --- src/Jackett.Common/Indexers/BaseIndexer.cs | 5 +++-- src/Jackett.Common/Indexers/IIndexer.cs | 2 ++ src/Jackett/Controllers/DownloadController.cs | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Jackett.Common/Indexers/BaseIndexer.cs b/src/Jackett.Common/Indexers/BaseIndexer.cs index f471a99ad..e45b01ae2 100644 --- a/src/Jackett.Common/Indexers/BaseIndexer.cs +++ b/src/Jackett.Common/Indexers/BaseIndexer.cs @@ -34,6 +34,9 @@ namespace Jackett.Common.Indexers public string Type { get; protected set; } public virtual string ID { get { return GetIndexerID(GetType()); } } + [JsonConverter(typeof(EncodingJsonConverter))] + public Encoding Encoding { get; protected set; } + public virtual bool IsConfigured { get; protected set; } protected Logger logger; protected IIndexerConfigurationService configurationService; @@ -835,8 +838,6 @@ namespace Jackett.Common.Indexers public override TorznabCapabilities TorznabCaps { get; protected set; } - [JsonConverter(typeof(EncodingJsonConverter))] - public Encoding Encoding { get; protected set; } private List categoryMapping = new List(); protected WebClient webclient; diff --git a/src/Jackett.Common/Indexers/IIndexer.cs b/src/Jackett.Common/Indexers/IIndexer.cs index 1d761a4e6..472ac8357 100644 --- a/src/Jackett.Common/Indexers/IIndexer.cs +++ b/src/Jackett.Common/Indexers/IIndexer.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Text; using System.Threading.Tasks; using Jackett.Common.Models; using Jackett.Common.Models.IndexerConfig; @@ -30,6 +31,7 @@ namespace Jackett.Common.Indexers string Language { get; } string LastError { get; set; } string ID { get; } + Encoding Encoding { get; } TorznabCapabilities TorznabCaps { get; } diff --git a/src/Jackett/Controllers/DownloadController.cs b/src/Jackett/Controllers/DownloadController.cs index 00bf2bbe1..050ece4fc 100644 --- a/src/Jackett/Controllers/DownloadController.cs +++ b/src/Jackett/Controllers/DownloadController.cs @@ -71,9 +71,19 @@ namespace Jackett.Controllers } // This will fix torrents where the keys are not sorted, and thereby not supported by Sonarr. - var parser = new BencodeParser(); - var torrentDictionary = parser.Parse(downloadBytes); - byte[] sortedDownloadBytes = torrentDictionary.EncodeAsBytes(); + byte[] sortedDownloadBytes = null; + try + { + var parser = new BencodeParser(); + var torrentDictionary = parser.Parse(downloadBytes); + sortedDownloadBytes = torrentDictionary.EncodeAsBytes(); + } + catch (Exception e) + { + var content = indexer.Encoding.GetString(downloadBytes); + logger.Error(content); + throw new Exception("BencodeParser failed", e); + } var result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new ByteArrayContent(sortedDownloadBytes); From 3538fdfaf722e66abcee3e324e3484a1970e1b58 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Fri, 15 Jun 2018 11:58:29 +0200 Subject: [PATCH 11/13] Synthesiz3r: removed (dead) --- README.md | 1 - src/Jackett.Common/Indexers/Synthesiz3r.cs | 36 ---------------------- 2 files changed, 37 deletions(-) delete mode 100644 src/Jackett.Common/Indexers/Synthesiz3r.cs diff --git a/README.md b/README.md index d17518584..82d6dae9a 100644 --- a/README.md +++ b/README.md @@ -241,7 +241,6 @@ Developer note: The software implements the [Torznab](https://github.com/Sonarr/ * SportsCult * SportHD * Superbits - * Synthesiz3r * Tasmanit * TBPlus * TenYardTracker diff --git a/src/Jackett.Common/Indexers/Synthesiz3r.cs b/src/Jackett.Common/Indexers/Synthesiz3r.cs deleted file mode 100644 index d1ee4332f..000000000 --- a/src/Jackett.Common/Indexers/Synthesiz3r.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; -using Jackett.Common.Indexers.Abstract; -using Jackett.Common.Models; -using Jackett.Common.Services.Interfaces; -using Jackett.Common.Utils.Clients; -using NLog; - -namespace Jackett.Common.Indexers -{ - public class Synthesiz3r : GazelleTracker - { - public Synthesiz3r(IIndexerConfigurationService configService, WebClient webClient, Logger logger, IProtectionService protectionService) - : base(name: "Synthesiz3r", - desc: "Synthesiz3r (ST3) is a Private Torrent Tracker for ELECTRONIC MUSIC", - link: "https://synthesiz3r.com/", - configService: configService, - logger: logger, - protectionService: protectionService, - webClient: webClient, - supportsFreeleechTokens: true - ) - { - Language = "en-us"; - Type = "private"; - TorznabCaps.SupportedMusicSearchParamsList = new List() { "q", "album", "artist", "label", "year" }; - - AddCategoryMapping(1, TorznabCatType.Audio, "Music"); - AddCategoryMapping(2, TorznabCatType.PC, "Applications"); - AddCategoryMapping(3, TorznabCatType.Books, "E-Books"); - AddCategoryMapping(4, TorznabCatType.AudioAudiobook, "Audiobooks"); - AddCategoryMapping(5, TorznabCatType.Movies, "E-Learning Videos"); - AddCategoryMapping(6, TorznabCatType.TV, "Comedy"); - AddCategoryMapping(7, TorznabCatType.Books, "Comics"); - } - } -} From c109133fcca68b739c608365c83f0e0cbff39a48 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Fri, 15 Jun 2018 17:14:56 +0200 Subject: [PATCH 12/13] Redacted: fix download without FL tokens --- .../Indexers/Abstract/GazelleTracker.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs index 64ed10be4..cfad185c4 100644 --- a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs @@ -283,5 +283,28 @@ namespace Jackett.Common.Indexers.Abstract release.UploadVolumeFactor = 0; } } + + public override async Task Download(Uri link) + { + var content = await base.Download(link); + + // Check if we're out of FL tokens + // most gazelle trackers will simply return the torrent anyway but e.g. redacted will return an error + var requestLink = link.ToString(); + if (content.Length >= 1 + && content[0] != 'd' // simple test for torrent vs HTML content + && requestLink.Contains("usetoken=1")) + { + var html = Encoding.UTF8.GetString(content); + if (html.Contains("You do not have any freeleech tokens left.")) + { + // download again with usetoken=0 + var requestLinkNew = requestLink.Replace("usetoken=1", "usetoken=0"); + content = await base.Download(new Uri(requestLinkNew)); + } + } + + return content; + } } } From f1d774aa078ef2808f09a33e2d8839e385cd50d3 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Fri, 15 Jun 2018 17:18:47 +0200 Subject: [PATCH 13/13] Gazelle: don't use hardcoded encoding --- src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs index cfad185c4..115a66f3d 100644 --- a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs @@ -295,7 +295,7 @@ namespace Jackett.Common.Indexers.Abstract && content[0] != 'd' // simple test for torrent vs HTML content && requestLink.Contains("usetoken=1")) { - var html = Encoding.UTF8.GetString(content); + var html = Encoding.GetString(content); if (html.Contains("You do not have any freeleech tokens left.")) { // download again with usetoken=0