mirror of
				https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
				synced 2025-10-29 17:40:15 +00:00 
			
		
		
		
	
							
								
								
									
										15
									
								
								script.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								script.py
									
									
									
									
									
								
							| @@ -6,17 +6,19 @@ saved posts from a reddit account. It is written in Python 3. | ||||
| """ | ||||
|  | ||||
| import argparse | ||||
| import logging | ||||
| import os | ||||
| import sys | ||||
| import time | ||||
| from io import StringIO | ||||
| from pathlib import Path, PurePath | ||||
|  | ||||
| from src.downloader import Direct, Gfycat, Imgur, Self | ||||
| from src.errors import * | ||||
| from src.parser import LinkDesigner | ||||
| from src.searcher import getPosts | ||||
| from src.tools import (GLOBAL, createLogFile, jsonFile, nameCorrector, | ||||
|                        printToFile) | ||||
| from src.errors import * | ||||
|  | ||||
| __author__ = "Ali Parlakci" | ||||
| __license__ = "GPL" | ||||
| @@ -637,11 +639,22 @@ def main(): | ||||
|         download(POSTS) | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|  | ||||
|     log_stream = StringIO()     | ||||
|     logging.basicConfig(stream=log_stream, level=logging.INFO) | ||||
|  | ||||
|     try: | ||||
|         VanillaPrint = print | ||||
|         print = printToFile | ||||
|         GLOBAL.RUN_TIME = time.time() | ||||
|         main() | ||||
|     except KeyboardInterrupt: | ||||
|         if GLOBAL.directory is None: | ||||
|             GLOBAL.directory = Path(".\\") | ||||
|         print("\nQUITTING...") | ||||
|         quit() | ||||
|     except Exception as exception: | ||||
|         logging.error("Runtime error!", exc_info=full_exc_info(sys.exc_info())) | ||||
|         print(log_stream.getvalue()) | ||||
|  | ||||
|     input("Press enter to quit\n") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user