mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
RARBG: add token renewal to download logic
This commit is contained in:
@@ -256,7 +256,16 @@ namespace Jackett.Common.Indexers
|
||||
public override async Task<byte[]> 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");
|
||||
|
||||
|
Reference in New Issue
Block a user