diff --git a/bdfr/site_downloaders/imgur.py b/bdfr/site_downloaders/imgur.py index bd974be..44a62f1 100644 --- a/bdfr/site_downloaders/imgur.py +++ b/bdfr/site_downloaders/imgur.py @@ -37,9 +37,10 @@ class Imgur(BaseDownloader): @staticmethod def _get_data(link: str) -> dict: - if re.match(r'.*\.gifv$', link): + link = link.rstrip('?') + if re.match(r'(?i).*\.gifv$', link): link = link.replace('i.imgur', 'imgur') - link = re.sub('\\.gifv$', '', link) + link = re.sub('(?i)\\.gifv$', '', link) res = Imgur.retrieve_url(link, cookies={'over18': '1', 'postpagebeta': '0'}) diff --git a/tests/site_downloaders/test_imgur.py b/tests/site_downloaders/test_imgur.py index 0e557ed..aa93795 100644 --- a/tests/site_downloaders/test_imgur.py +++ b/tests/site_downloaders/test_imgur.py @@ -132,10 +132,16 @@ def test_imgur_extension_validation_bad(test_extension: str): ), ( 'https://i.imgur.com/lFJai6i.gifv', - ( - '01a6e79a30bec0e644e5da12365d5071', - ), - ) + ('01a6e79a30bec0e644e5da12365d5071',), + ), + ( + 'https://i.imgur.com/ywSyILa.gifv?', + ('56d4afc32d2966017c38d98568709b45',), + ), + ( + 'https://imgur.com/ubYwpbk.GIFV', + ('d4a774aac1667783f9ed3a1bd02fac0c',), + ), )) def test_find_resources(test_url: str, expected_hashes: list[str]): mock_download = Mock()