From e0a36f4eab2a4ba23b98f19bf4bdef2b7287301d Mon Sep 17 00:00:00 2001 From: SoulSuck24 <79275800+Soulsuck24@users.noreply.github.com> Date: Mon, 12 Sep 2022 22:26:02 -0400 Subject: [PATCH] Re-fix Redgifs API seems to return incorrect signature value when sending header. Other fixes seems to have worked temporarily but have stopped working so they're removed. --- bdfr/site_downloaders/redgifs.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/bdfr/site_downloaders/redgifs.py b/bdfr/site_downloaders/redgifs.py index 26b9dfc..e2d27e7 100644 --- a/bdfr/site_downloaders/redgifs.py +++ b/bdfr/site_downloaders/redgifs.py @@ -28,12 +28,7 @@ class Redgifs(BaseDownloader): except AttributeError: raise SiteDownloaderError(f'Could not extract Redgifs ID from {url}') - headers = { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' - 'Chrome/90.0.4430.93 Safari/537.36', - } - - content = Redgifs.retrieve_url(f'https://api.redgifs.com/v2/gifs/{redgif_id}', headers=headers) + content = Redgifs.retrieve_url(f'https://api.redgifs.com/v2/gifs/{redgif_id}') if content is None: raise SiteDownloaderError('Could not read the page source') @@ -62,14 +57,4 @@ class Redgifs(BaseDownloader): except (KeyError, AttributeError): raise SiteDownloaderError('Failed to find JSON data in page') - # returned domain seems to be being phased out - out = {re.sub('thumbs2', 'thumbs3', link) for link in out} - out = {Redgifs._clean_thumbs4_link(link) for link in out} - return out - - @staticmethod - def _clean_thumbs4_link(url: str) -> str: - split_url = urllib.parse.urlsplit(url) - out = split_url.scheme + '://' + split_url.netloc + split_url.path - out = re.sub('thumbs4', 'thumbs3', out) return out