From 105ceaf386cf782202eea4db1b1e3487f0a127a7 Mon Sep 17 00:00:00 2001 From: Soulsuck24 <79275800+Soulsuck24@users.noreply.github.com> Date: Wed, 25 Jan 2023 04:43:06 -0500 Subject: [PATCH] More Redgifs coverage --- bdfr/site_downloaders/redgifs.py | 2 +- tests/site_downloaders/test_redgifs.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bdfr/site_downloaders/redgifs.py b/bdfr/site_downloaders/redgifs.py index 205674a..9c469bc 100644 --- a/bdfr/site_downloaders/redgifs.py +++ b/bdfr/site_downloaders/redgifs.py @@ -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: diff --git a/tests/site_downloaders/test_redgifs.py b/tests/site_downloaders/test_redgifs.py index 5f4f6fc..9d1a7f5 100644 --- a/tests/site_downloaders/test_redgifs.py +++ b/tests/site_downloaders/test_redgifs.py @@ -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):