Fix downloading .gifv instead of .mp4 (#228)

This commit is contained in:
Ali Parlakci 2021-03-27 23:00:47 +03:00
parent 58150570a3
commit 247fe3e6f7
2 changed files with 3 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class DownloadFactory:
return Gfycat
elif re.match(url_beginning + r'gifdeliverynetwork', url):
return GifDeliveryNetwork
elif re.match(url_beginning + r'imgur.*', url):
elif re.match(url_beginning + r'imgur.*', url) or re.match(url_beginning + r'i\.imgur.*\.gifv$', url):
return Imgur
elif re.match(url_beginning + r'redgifs.com', url):
return Redgifs

View File

@ -38,6 +38,8 @@ class Imgur(BaseDownloader):
@staticmethod
def _get_data(link: str) -> dict:
if re.match(r".*i\.imgur\.com.*\.gifv$", link):
link = link.replace("i.imgur", "imgur")[:-5]
res = requests.get(link, cookies={'over18': '1', 'postpagebeta': '0'})
if res.status_code != 200: