More Redgifs coverage

This commit is contained in:
Soulsuck24 2023-01-25 04:43:06 -05:00
parent 579c5ab8eb
commit 105ceaf386
No known key found for this signature in database
GPG Key ID: EDBD4E9B4DA565B4
2 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,7 @@ class Redgifs(BaseDownloader):
try:
if url.endswith("/"):
url = url.removesuffix("/")
redgif_id = re.match(r".*/(.*?)(?:\?.*|\..{0,})?$", url).group(1).lower()
redgif_id = re.match(r".*/(.*?)(?:#.*|\?.*|\..{0,})?$", url).group(1).lower()
if redgif_id.endswith("-mobile"):
redgif_id = redgif_id.removesuffix("-mobile")
except AttributeError:

View File

@ -18,6 +18,7 @@ from bdfr.site_downloaders.redgifs import Redgifs
("https://www.redgifs.com/watch/marriedcrushingcob?rel=u%3Akokiri.girl%3Bo%3Arecent", "marriedcrushingcob"),
("https://thumbs4.redgifs.com/DismalIgnorantDrongo.mp4", "dismalignorantdrongo"),
("https://thumbs4.redgifs.com/DismalIgnorantDrongo-mobile.mp4", "dismalignorantdrongo"),
("https://v3.redgifs.com/watch/newilliteratemeerkat#rel=user%3Atastynova", "newilliteratemeerkat"),
),
)
def test_get_id(test_url: str, expected: str):