mirror of
				https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
				synced 2025-10-29 17:40:15 +00:00 
			
		
		
		
	| @@ -41,6 +41,12 @@ It should redirect to a page which shows your **imgur_client_id** and **imgur_cl | ||||
| \* Select **OAuth 2 authorization without a callback URL** first then select **Anonymous usage without user authorization** if it says *Authorization callback URL: required* | ||||
|  | ||||
| ## FAQ | ||||
| ### What do the dots resemble when getting posts? | ||||
| - Each dot means that 100 posts are scanned.  | ||||
|    | ||||
| ### Getting posts is taking too long. | ||||
| - You can press Ctrl+C to interrupt it and start downloading. | ||||
|    | ||||
| ### How downloaded files' names are formatted? | ||||
| - Images that are not belong to an album or self posts are formatted as **`[SUBMITTER NAME]_[POST TITLE]_[REDDIT ID]`**. | ||||
|   You can use *reddit id* to go to post's reddit page by going to link **reddit.com/[REDDIT ID]** | ||||
|   | ||||
| @@ -10,13 +10,13 @@ usage: script.py [-h] [--directory DIRECTORY] [--link link] [--saved] | ||||
|                  [--subreddit SUBREDDIT [SUBREDDIT ...]] | ||||
|                  [--multireddit MULTIREDDIT] [--user redditor] | ||||
|                  [--search query] [--sort SORT TYPE] [--limit Limit] | ||||
|                  [--time TIME_LIMIT] [--NoDownload] | ||||
|                  [--time TIME_LIMIT] [--NoDownload] [--verbose] | ||||
|  | ||||
| This program downloads media from reddit posts | ||||
|  | ||||
| optional arguments: | ||||
|   -h, --help            show this help message and exit | ||||
|   --directory DIRECTORY | ||||
|   --directory DIRECTORY, -d DIRECTORY | ||||
|                         Specifies the directory where posts will be downloaded | ||||
|                         to | ||||
|   --link link, -l link  Get posts from link | ||||
| @@ -40,6 +40,7 @@ optional arguments: | ||||
|                         all | ||||
|   --NoDownload          Just gets the posts and store them in a file for | ||||
|                         downloading later | ||||
|   --verbose, -v         Verbose Mode | ||||
| ``` | ||||
|  | ||||
| # Examples | ||||
|   | ||||
| @@ -62,7 +62,7 @@ def parseArguments(arguments=[]): | ||||
|                                      description="This program downloads " \ | ||||
|                                                  "media from reddit " \ | ||||
|                                                  "posts") | ||||
|     parser.add_argument("--directory", | ||||
|     parser.add_argument("--directory","-d", | ||||
|                         help="Specifies the directory where posts will be " \ | ||||
|                         "downloaded to", | ||||
|                         metavar="DIRECTORY") | ||||
| @@ -144,6 +144,11 @@ def parseArguments(arguments=[]): | ||||
|                         action="store_true", | ||||
|                         default=False) | ||||
|      | ||||
|     parser.add_argument("--verbose","-v", | ||||
|                         help="Verbose Mode", | ||||
|                         action="store_true", | ||||
|                         default=False) | ||||
|      | ||||
|  | ||||
|     if arguments == []: | ||||
|         return parser.parse_args() | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| import os | ||||
| import sys | ||||
| import random | ||||
| import socket | ||||
| import webbrowser | ||||
| @@ -306,6 +307,7 @@ def redditSearcher(posts,SINGLE_POST=False): | ||||
|  | ||||
|     allPosts = {} | ||||
|  | ||||
|     print("GETTING POSTS") | ||||
|     postsFile = createLogFile("POSTS") | ||||
|  | ||||
|     if SINGLE_POST: | ||||
| @@ -326,15 +328,25 @@ def redditSearcher(posts,SINGLE_POST=False): | ||||
|         if result is not None: | ||||
|             details = result | ||||
|             orderCount += 1 | ||||
|             if GLOBAL.arguments.verbose: | ||||
|                 printSubmission(submission,subCount,orderCount) | ||||
|             subList.append(details) | ||||
|  | ||||
|         postsFile.add({subCount:[details]}) | ||||
|  | ||||
|     else: | ||||
|         try: | ||||
|             for submission in posts: | ||||
|                 subCount += 1 | ||||
|  | ||||
|                 if subCount % 100 == 0 and not GLOBAL.arguments.verbose: | ||||
|                     sys.stdout.write("• ") | ||||
|                     sys.stdout.flush() | ||||
|  | ||||
|                 if subCount % 1000 == 0: | ||||
|                     sys.stdout.write("\n") | ||||
|                     sys.stdout.flush() | ||||
|  | ||||
|                 try: | ||||
|                     details = {'postId':submission.id, | ||||
|                             'postTitle':submission.title, | ||||
| @@ -350,25 +362,22 @@ def redditSearcher(posts,SINGLE_POST=False): | ||||
|                 if result is not None: | ||||
|                     details = result | ||||
|                     orderCount += 1 | ||||
|                     if GLOBAL.arguments.verbose: | ||||
|                         printSubmission(submission,subCount,orderCount) | ||||
|                     subList.append(details) | ||||
|  | ||||
|                 allPosts[subCount] = [details] | ||||
|         except KeyboardInterrupt: | ||||
|             print("\nKeyboardInterrupt",end="") | ||||
|          | ||||
|         postsFile.add(allPosts) | ||||
|  | ||||
|     if not len(subList) == 0:     | ||||
|         print( | ||||
|             "\nTotal of {} submissions found!\n"\ | ||||
|             "{} GFYCATs, {} IMGURs, {} EROMEs, {} DIRECTs and {} SELF POSTS\n" | ||||
|             .format( | ||||
|                 len(subList), | ||||
|                 gfycatCount, | ||||
|                 imgurCount, | ||||
|                 eromeCount, | ||||
|                 directCount, | ||||
|                 selfCount | ||||
|             ) | ||||
|             f"\n\nTotal of {len(subList)} submissions found!\n"\ | ||||
|             f"{gfycatCount} GFYCATs, {imgurCount} IMGURs, " \ | ||||
|             f"{eromeCount} EROMEs, {directCount} DIRECTs " \ | ||||
|             f"and {selfCount} SELF POSTS" | ||||
|         ) | ||||
|         return subList | ||||
|     else: | ||||
|   | ||||
| @@ -103,6 +103,7 @@ def printToFile(*args, **kwargs): | ||||
|     if not path.exists(folderDirectory): | ||||
|         makedirs(folderDirectory) | ||||
|      | ||||
|     if not "file" in kwargs: | ||||
|         with io.open( | ||||
|             folderDirectory / "CONSOLE_LOG.txt","a",encoding="utf-8" | ||||
|         ) as FILE: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user