1
0
Fork 0
mirror of synced 2024-06-01 18:09:47 +12:00

Fix gfycat after redgifs changes

This commit is contained in:
Serene-Arc 2022-02-18 12:49:46 +10:00
parent 71f84420cb
commit 7645319510
2 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@ class Gfycat(Redgifs):
return super().find_resources(authenticator) return super().find_resources(authenticator)
@staticmethod @staticmethod
def _get_link(url: str) -> str: def _get_link(url: str) -> set[str]:
gfycat_id = re.match(r'.*/(.*?)/?$', url).group(1) gfycat_id = re.match(r'.*/(.*?)/?$', url).group(1)
url = 'https://gfycat.com/' + gfycat_id url = 'https://gfycat.com/' + gfycat_id
@ -39,4 +39,4 @@ class Gfycat(Redgifs):
raise SiteDownloaderError(f'Failed to download Gfycat link {url}: {e}') raise SiteDownloaderError(f'Failed to download Gfycat link {url}: {e}')
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
raise SiteDownloaderError(f'Did not receive valid JSON data: {e}') raise SiteDownloaderError(f'Did not receive valid JSON data: {e}')
return out return {out,}

View file

@ -16,7 +16,7 @@ from bdfr.site_downloaders.gfycat import Gfycat
)) ))
def test_get_link(test_url: str, expected_url: str): def test_get_link(test_url: str, expected_url: str):
result = Gfycat._get_link(test_url) result = Gfycat._get_link(test_url)
assert result == expected_url assert result.pop() == expected_url
@pytest.mark.online @pytest.mark.online