Redgifs fix
Handle redgifs link with trailing / causing id to return empty string.
This commit is contained in:
@@ -24,6 +24,8 @@ class Redgifs(BaseDownloader):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_link(url: str) -> set[str]:
|
def _get_link(url: str) -> set[str]:
|
||||||
try:
|
try:
|
||||||
|
if url.endswith("/"):
|
||||||
|
url = url.removesuffix("/")
|
||||||
redgif_id = re.match(r".*/(.*?)(\..{0,})?$", url).group(1)
|
redgif_id = re.match(r".*/(.*?)(\..{0,})?$", url).group(1)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise SiteDownloaderError(f"Could not extract Redgifs ID from {url}")
|
raise SiteDownloaderError(f"Could not extract Redgifs ID from {url}")
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from bdfr.site_downloaders.redgifs import Redgifs
|
|||||||
"UnripeUnkemptWoodpecker-large.jpg",
|
"UnripeUnkemptWoodpecker-large.jpg",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
("https://www.redgifs.com/watch/genuineprivateguillemot/", {"GenuinePrivateGuillemot.mp4"}),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_get_link(test_url: str, expected: set[str]):
|
def test_get_link(test_url: str, expected: set[str]):
|
||||||
|
|||||||
Reference in New Issue
Block a user