MonkeyMaster64 / Reddit-User-Media-Downloader-Public

480 stars 42 forks source link

Error when writing file to Windows when URL contains `?` #7

Open bstincer opened 3 years ago

bstincer commented 3 years ago

Traceback (most recent call last): File "reddit-media-downloader.py", line 184, in main() File "reddit-media-downloader.py", line 164, in main get_posts('submission', {**json.loads(args.pushshift_params), 'subreddit':args.subreddit, 'author':args.user}, submission_callback) File "reddit-media-downloader.py", line 57, in get_posts cb(data) File "reddit-media-downloader.py", line 69, in submission_callback process_submission(post) File "reddit-media-downloader.py", line 81, in process_submission with open(f"{post['author']}{datetime.datetime.now().strftime('%Y-%m-%dT%H%M%S')}-{post['url'].split('/')[-1]}", "wb+") as f: OSError: [Errno 22] Invalid argument: 'theawesomekate\2021-05-25T102048-qSkDhpk.jpg?1'