diff --git a/src/downloaders/redgifs.py b/src/downloaders/redgifs.py index af2e4ec..95502de 100644 --- a/src/downloaders/redgifs.py +++ b/src/downloaders/redgifs.py @@ -36,7 +36,9 @@ class Redgifs: if url[-1:] == '/': url = url[:-1] - url = "https://redgifs.com/watch/" + url.split('/')[-1] + url = urllib.request.Request("https://redgifs.com/watch/" + url.split('/')[-1]) + + url.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 OPR/54.0.2952.64') pageSource = (urllib.request.urlopen(url).read().decode()) @@ -47,4 +49,4 @@ class Redgifs: if content is None: raise NotADownloadableLinkError("Could not read the page source") - return json.loads(content.contents[0])["video"]["contentUrl"] \ No newline at end of file + return json.loads(content.contents[0])["video"]["contentUrl"]