Skip to content

Commit

Permalink
Merge branch 'aliparlakci:development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
OMEGARAZER authored Dec 27, 2022
2 parents 7713954 + 0bb9404 commit 8a4745b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bdfr/site_downloaders/redgifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def _get_id(url: str) -> str:
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).lower()
if redgif_id.endswith("-mobile"):
redgif_id = redgif_id.removesuffix("-mobile")
except AttributeError:
raise SiteDownloaderError(f"Could not extract Redgifs ID from {url}")
return redgif_id
Expand Down
2 changes: 2 additions & 0 deletions tests/site_downloaders/test_redgifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
("https://redgifs.com/watch/frighteningvictorioussalamander", "frighteningvictorioussalamander"),
("https://www.redgifs.com/watch/genuineprivateguillemot/", "genuineprivateguillemot"),
("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"),
),
)
def test_get_id(test_url: str, expected: str):
Expand Down

0 comments on commit 8a4745b

Please sign in to comment.