diff --git a/bdfr/site_downloaders/imgur.py b/bdfr/site_downloaders/imgur.py index f91e34f2..0b9ecdd5 100644 --- a/bdfr/site_downloaders/imgur.py +++ b/bdfr/site_downloaders/imgur.py @@ -41,7 +41,7 @@ def _compute_image_url(self, image: dict) -> Resource: @staticmethod def _get_data(link: str) -> dict: try: - imgur_id = re.match(r".*/(.*?)(\..{0,})?$", link).group(1) + imgur_id = re.match(r".*/(.*?)(_d)?(\..{0,})?$", link).group(1) gallery = "a/" if re.search(r".*/(.*?)(gallery/|a/)", link) else "" link = f"https://imgur.com/{gallery}{imgur_id}" except AttributeError: diff --git a/tests/site_downloaders/test_imgur.py b/tests/site_downloaders/test_imgur.py index 38dbdc54..6b49cd56 100644 --- a/tests/site_downloaders/test_imgur.py +++ b/tests/site_downloaders/test_imgur.py @@ -170,6 +170,10 @@ def test_imgur_extension_validation_bad(test_extension: str): "http://i.imgur.com/s9uXxlq.jpg?5.jpg", ("338de3c23ee21af056b3a7c154e2478f",), ), + ( + "https://i.imgur.com/2TtN68l_d.webp", + ("6569ab9ad9fa68d93f6b408f112dd741",), + ), ), ) def test_find_resources(test_url: str, expected_hashes: list[str]):