Stop videos from being downloaded as images

Erroneous .gifv extensions such as .giff or .gift resolve to a static image and are downloaded by the direct downloader. (ex: https://i.imgur.com/OGeVuAe.giff  )
This commit is contained in:
OMEGARAZER
2021-11-09 19:30:27 -05:00
committed by Ali Parlakçı
parent 4be0f5ec19
commit f05e909008
2 changed files with 3 additions and 3 deletions

View File

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