Code cleanup

This commit is contained in:
Doc
2023-12-17 11:23:21 +01:00
parent 622d96324a
commit 36865b6d16
2 changed files with 2 additions and 7 deletions

View File

@@ -1,4 +1,3 @@
requests
argparse
Pillow
ffmpeg-python

View File

@@ -1,4 +1,4 @@
import requests, json, time, argparse, sys, os, ffmpeg
import requests, json, time, argparse, sys, os
from PIL import Image
from io import BytesIO
@@ -38,15 +38,11 @@ for i in rjson['posts']:
sys.exit(130)
except SystemExit:
os._exit(130)
except:
except:
try:
#os.mkdir(args.o + "/" + ".temp/")
#print("Bytes: " + str(bstream))
with open(args.o + "/" + str(i['tim']) + i['ext'], 'wb') as f:
f.write(bstream.getbuffer())
f.close()
#ffmpeg.input(args.o + "/" + ".temp/" + str(i['tim'])).output(args.o + "/" + str(i['tim']) + ".mp4").run()
print("Saved video")
except Exception as err:
print("Cant convert data to image or video maybe not an image or video format")