From fd0c92f4397ad2881a3ed5a97e2278a0187596c1 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 1 Nov 2018 16:47:23 +0100 Subject: [PATCH] RARBG: add token renewal to download logic --- src/Jackett.Common/Indexers/Rarbg.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/Rarbg.cs b/src/Jackett.Common/Indexers/Rarbg.cs index 23595f6a5..771c6274f 100644 --- a/src/Jackett.Common/Indexers/Rarbg.cs +++ b/src/Jackett.Common/Indexers/Rarbg.cs @@ -256,7 +256,16 @@ namespace Jackett.Common.Indexers public override async Task Download(Uri link) { // build download link from info redirect link - var response = await RequestStringWithCookies(link.ToString()); + var slink = link.ToString(); + var response = await RequestStringWithCookies(slink); + if (!response.IsRedirect && response.Content.Contains("Invalid token.")) + { + // get new token + token = null; + await CheckToken(); + slink += "&token=" + token; + response = await RequestStringWithCookies(slink); + } if (!response.IsRedirect) throw new Exception("Downlaod Failed, expected redirect");