From a176ebb2438cc20620ce3540a872800e577d8140 Mon Sep 17 00:00:00 2001 From: enduser420 Date: Thu, 20 Oct 2022 19:09:11 +0530 Subject: [PATCH] [redgifs] fix 'token' extraction --- gallery_dl/extractor/redgifs.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gallery_dl/extractor/redgifs.py b/gallery_dl/extractor/redgifs.py index 1111c3ad14..ac1bcac31a 100644 --- a/gallery_dl/extractor/redgifs.py +++ b/gallery_dl/extractor/redgifs.py @@ -173,13 +173,7 @@ def _pagination(self, endpoint, params): @cache(maxage=3600) def _fetch_bearer_token(self, extr): extr.log.debug("Retrieving Bearer token") - - page = extr.request(extr.root + "/").text - index = text.extract(page, "/assets/js/index", ".js")[0] - - url = extr.root + "/assets/js/index" + index + ".js" - page = extr.request(url, encoding="utf-8").text - token = "ey" + text.extract(page, '="ey', '"')[0] - + token = extr.request( + self.API_ROOT + "/v2/auth/temporary").json()["token"] extr.log.debug("Token: '%s'", token) return token