mirror of
				https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
				synced 2025-10-29 17:40:15 +00:00 
			
		
		
		
	Update version
This commit is contained in:
		| @@ -1,4 +1,7 @@ | ||||
| # Changes on *master* | ||||
| ##[23/02/2019](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/4d385fda60028343be816eb7c4f7bc613a9d555d) | ||||
| - Fixed v.redd.it links | ||||
|  | ||||
| ## [27/01/2019](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/b7baf07fb5998368d87e3c4c36aed40daf820609) | ||||
| - Clarified the instructions | ||||
|  | ||||
|   | ||||
| @@ -674,8 +674,11 @@ def main(): | ||||
|  | ||||
|     if not Path(GLOBAL.configDirectory).is_dir(): | ||||
|         os.makedirs(GLOBAL.configDirectory) | ||||
|     GLOBAL.config = getConfig("config.json") if Path("config.json").exists() \ | ||||
|                     else getConfig(GLOBAL.configDirectory / "config.json") | ||||
|  | ||||
|     GLOBAL.configDirectory = Path("config.json") if Path("config.json").exists() \ | ||||
|                     else GLOBAL.defaultConfigDirectory  / "config.json" | ||||
|  | ||||
|     GLOBAL.config = getConfig(GLOBAL.configDirectory) | ||||
|  | ||||
|     if GLOBAL.arguments.log is not None: | ||||
|         logDir = Path(GLOBAL.arguments.log) | ||||
|   | ||||
| @@ -3,6 +3,8 @@ import sys | ||||
| import random | ||||
| import socket | ||||
| import webbrowser | ||||
| import urllib.request | ||||
| from urllib.error import HTTPError | ||||
|  | ||||
| import praw | ||||
| from prawcore.exceptions import NotFound, ResponseException, Forbidden | ||||
| @@ -93,7 +95,7 @@ def beginPraw(config,user_agent = str(socket.gethostname())): | ||||
|             authorizedInstance = GetAuth(reddit,port).getRefreshToken(*scopes) | ||||
|             reddit = authorizedInstance[0] | ||||
|             refresh_token = authorizedInstance[1] | ||||
|             jsonFile(GLOBAL.configDirectory / "config.json").add({ | ||||
|             jsonFile(GLOBAL.configDirectory).add({ | ||||
|                 "reddit_username":str(reddit.user.me()), | ||||
|                 "reddit_refresh_token":refresh_token | ||||
|             }) | ||||
| @@ -103,7 +105,7 @@ def beginPraw(config,user_agent = str(socket.gethostname())): | ||||
|         authorizedInstance = GetAuth(reddit,port).getRefreshToken(*scopes) | ||||
|         reddit = authorizedInstance[0] | ||||
|         refresh_token = authorizedInstance[1] | ||||
|         jsonFile(GLOBAL.configDirectory / "config.json").add({ | ||||
|         jsonFile(GLOBAL.configDirectory).add({ | ||||
|             "reddit_username":str(reddit.user.me()), | ||||
|             "reddit_refresh_token":refresh_token | ||||
|         }) | ||||
| @@ -422,18 +424,20 @@ def checkIfMatching(submission): | ||||
|         eromeCount += 1 | ||||
|         return details | ||||
|  | ||||
|     elif isDirectLink(submission.url) is not False: | ||||
|         details['postType'] = 'direct' | ||||
|         details['postURL'] = isDirectLink(submission.url) | ||||
|         directCount += 1 | ||||
|         return details | ||||
|  | ||||
|     elif submission.is_self: | ||||
|         details['postType'] = 'self' | ||||
|         details['postContent'] = submission.selftext | ||||
|         selfCount += 1 | ||||
|         return details | ||||
|  | ||||
|     directLink = isDirectLink(submission.url) | ||||
|  | ||||
|     if directLink is not False: | ||||
|         details['postType'] = 'direct' | ||||
|         details['postURL'] = directLink | ||||
|         directCount += 1 | ||||
|         return details | ||||
|  | ||||
| def printSubmission(SUB,validNumber,totalNumber): | ||||
|     """Print post's link, title and media link to screen""" | ||||
|  | ||||
| @@ -473,7 +477,22 @@ def isDirectLink(URL): | ||||
|         return URL | ||||
|  | ||||
|     elif "v.redd.it" in URL: | ||||
|         return URL+"/DASH_600_K" | ||||
|         bitrates = ["DASH_1080","DASH_720","DASH_600", \ | ||||
|                     "DASH_480","DASH_360","DASH_240"] | ||||
|                      | ||||
|         for bitrate in bitrates: | ||||
|             videoURL = URL+"/"+bitrate | ||||
|  | ||||
|             try: | ||||
|                 responseCode = urllib.request.urlopen(videoURL).getcode() | ||||
|             except urllib.error.HTTPError: | ||||
|                 responseCode = 0 | ||||
|  | ||||
|             if responseCode == 200: | ||||
|                 return videoURL | ||||
|  | ||||
|         else: | ||||
|             return False | ||||
|  | ||||
|     for extension in imageTypes: | ||||
|         if extension in URL: | ||||
|   | ||||
| @@ -14,7 +14,8 @@ class GLOBAL: | ||||
|     config = None | ||||
|     arguments = None | ||||
|     directory = None | ||||
|     configDirectory = Path.home() / "Bulk Downloader for Reddit" | ||||
|     defaultConfigDirectory = Path.home() / "Bulk Downloader for Reddit" | ||||
|     configDirectory = "" | ||||
|     reddit_client_id = "BSyphDdxYZAgVQ" | ||||
|     reddit_client_secret = "bfqNJaRh8NMh-9eAr-t4TRz-Blk" | ||||
|     printVanilla = print | ||||
|   | ||||
		Reference in New Issue
	
	Block a user