Merge pull request #447 from Serene-Arc/bug_fix_446

Fix bug with Imgur gifs being shortened too much
This commit is contained in:
Serene
2021-06-08 13:15:10 +10:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -39,7 +39,7 @@ class Imgur(BaseDownloader):
def _get_data(link: str) -> dict: def _get_data(link: str) -> dict:
if re.match(r'.*\.gifv$', link): if re.match(r'.*\.gifv$', link):
link = link.replace('i.imgur', 'imgur') link = link.replace('i.imgur', 'imgur')
link = link.rstrip('.gifv') link = re.sub('\\.gifv$', '', link)
res = Imgur.retrieve_url(link, cookies={'over18': '1', 'postpagebeta': '0'}) res = Imgur.retrieve_url(link, cookies={'over18': '1', 'postpagebeta': '0'})

View File

@@ -130,6 +130,12 @@ def test_imgur_extension_validation_bad(test_extension: str):
'fb6c913d721c0bbb96aa65d7f560d385', 'fb6c913d721c0bbb96aa65d7f560d385',
), ),
), ),
(
'https://i.imgur.com/lFJai6i.gifv',
(
'01a6e79a30bec0e644e5da12365d5071',
),
)
)) ))
def test_find_resources(test_url: str, expected_hashes: list[str]): def test_find_resources(test_url: str, expected_hashes: list[str]):
mock_download = Mock() mock_download = Mock()