From 622d96324a44b94fd9ff12b2f94290b2b1b68156 Mon Sep 17 00:00:00 2001 From: Doc Date: Sun, 17 Dec 2023 11:21:18 +0100 Subject: [PATCH] Added support for webm videos --- scraperchan.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scraperchan.py b/scraperchan.py index 553f293..0088ad8 100644 --- a/scraperchan.py +++ b/scraperchan.py @@ -39,14 +39,19 @@ for i in rjson['posts']: except SystemExit: os._exit(130) except: - print("Cant convert data to image maybe not an image format") - print("NO:" + str(i['no'])) - """ + try: - ffmpeg.input(bstream).output(args.o + "/" + str(i['tim']) + ".mp4").run() + #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: - print("Cant convert to Video") - """ - + except Exception as err: + print("Cant convert data to image or video maybe not an image or video format") + print("NO: " + str(i['no'])) + print(err) + + time.sleep(1) print("Done!!")