remotes/1693045480750635534/spooky-22
Aevann1 2022-03-22 05:45:30 +02:00
parent 4d5a821005
commit cb9087a0d9
1 changed files with 2 additions and 1 deletions

View File

@ -311,7 +311,8 @@ def submit_contact(v):
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
try: url = req['link']
except: return {"error": req['error']}, 400
if url.endswith('.'): url += 'mp4'