From e974c7508320e66248336d47182f0da755c08326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 12 Oct 2022 11:17:05 +0200 Subject: [PATCH] [redgifs] fix extraction (#3037) send public Bearer token as 'authorization' header --- gallery_dl/extractor/redgifs.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/redgifs.py b/gallery_dl/extractor/redgifs.py index 3a4fb0e566..9c595a8c2f 100644 --- a/gallery_dl/extractor/redgifs.py +++ b/gallery_dl/extractor/redgifs.py @@ -88,7 +88,7 @@ class RedgifsSearchExtractor(RedgifsExtractor): pattern = r"(?:https?://)?(?:www\.)?redgifs\.com/browse/?\?([^#]+)" test = ( ("https://www.redgifs.com/browse?tags=JAV", { - "pattern": r"https://\w+\.redgifs\.com/[A-Za-z]+\.mp4", + "pattern": r"https://\w+\.redgifs\.com/[A-Za-z-]+\.mp4", "range": "1-10", "count": 10, }), @@ -148,8 +148,21 @@ def search(self, params): return self._pagination(endpoint, params) def _call(self, endpoint, params=None): + extr = self.extractor + url = self.API_ROOT + endpoint - return self.extractor.request(url, params=params).json() + headers = { + "Referer" : extr.root + "/", + "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJp" + "c3MiOiIxODIzYzMxZjdkMy03NDVhLTY1ODktMDAwNS1kOGU4" + "ZmUwYTQ0YzIiLCJleHAiOjE2NjYwOTgzMTIsInN1YiI6ImNs" + "aWVudFwvMTgyM2MzMWY3ZDMtNzQ1YS02NTg5LTAwMDUtZDhl" + "OGZlMGE0NGMyIiwic2NvcGVzIjoicmVhZCIsInJhdGUiOi0x" + "fQ.qG5aAxmUTktQyDeHK2oJfoBRPOpUSNEsA92cChei1x4", + "content-type" : "application/json", + "Origin" : extr.root, + } + return extr.request(url, params=params, headers=headers).json() def _pagination(self, endpoint, params): params["page"] = 1