1
0
Fork 0
mirror of synced 2024-04-25 07:52:17 +12:00

Fix error with old gfycat/redgifs urls

This commit is contained in:
alpbetgam 2021-05-16 14:16:47 +12:00 committed by Serene
parent 17226a4f0b
commit ef37712115
2 changed files with 2 additions and 0 deletions

View file

@ -27,6 +27,7 @@ class Gfycat(Redgifs):
response = Gfycat.retrieve_url(url)
if re.search(r'(redgifs|gifdeliverynetwork)', response.url):
url = url.lower() # Fixes error with old gfycat/redgifs links
return Redgifs._get_link(url)
soup = BeautifulSoup(response.text, 'html.parser')

View file

@ -14,6 +14,7 @@ from bdfr.site_downloaders.gfycat import Gfycat
('https://gfycat.com/definitivecaninecrayfish', 'https://giant.gfycat.com/DefinitiveCanineCrayfish.mp4'),
('https://gfycat.com/dazzlingsilkyiguana', 'https://giant.gfycat.com/DazzlingSilkyIguana.mp4'),
('https://gfycat.com/webbedimpurebutterfly', 'https://thumbs2.redgifs.com/WebbedImpureButterfly.mp4'),
('https://gfycat.com/CornyLoathsomeHarrierhawk', 'https://thumbs2.redgifs.com/CornyLoathsomeHarrierhawk.mp4')
))
def test_get_link(test_url: str, expected_url: str):
result = Gfycat._get_link(test_url)