mirror of
https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
synced 2025-10-29 17:40:15 +00:00
Added v.redd.it support (#36)
This commit is contained in:
@@ -54,6 +54,7 @@ It should redirect to a page which shows your **imgur_client_id** and **imgur_cl
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
### 19/07/2018
|
### 19/07/2018
|
||||||
|
- Added v.redd.it support
|
||||||
- Added custom exception descriptions to FAILED.json file
|
- Added custom exception descriptions to FAILED.json file
|
||||||
|
|
||||||
### [13/07/2018](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/9f831e1b784a770c82252e909462871401a05c11)
|
### [13/07/2018](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/9f831e1b784a770c82252e909462871401a05c11)
|
||||||
|
|||||||
@@ -246,7 +246,6 @@ class PromptUser:
|
|||||||
# DELETE THE PLUS (+) AT THE END
|
# DELETE THE PLUS (+) AT THE END
|
||||||
GLOBAL.arguments.subreddit = GLOBAL.arguments.subreddit[:-1]
|
GLOBAL.arguments.subreddit = GLOBAL.arguments.subreddit[:-1]
|
||||||
|
|
||||||
print(GLOBAL.arguments.subreddit)
|
|
||||||
print("\nselect sort type:")
|
print("\nselect sort type:")
|
||||||
sortTypes = [
|
sortTypes = [
|
||||||
"hot","top","new","rising","controversial"
|
"hot","top","new","rising","controversial"
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ def getExtension(link):
|
|||||||
if TYPE in parsed:
|
if TYPE in parsed:
|
||||||
return "."+parsed[-1]
|
return "."+parsed[-1]
|
||||||
else:
|
else:
|
||||||
return '.jpg'
|
if not "v.redd.it" in link:
|
||||||
|
return '.jpg'
|
||||||
|
else:
|
||||||
|
return '.mp4'
|
||||||
|
|
||||||
def getFile(fileDir,tempDir,imageURL,indent=0):
|
def getFile(fileDir,tempDir,imageURL,indent=0):
|
||||||
"""Downloads given file to given directory.
|
"""Downloads given file to given directory.
|
||||||
|
|||||||
@@ -397,8 +397,9 @@ def checkIfMatching(submission):
|
|||||||
imgurCount += 1
|
imgurCount += 1
|
||||||
return details
|
return details
|
||||||
|
|
||||||
elif isDirectLink(submission.url):
|
elif isDirectLink(submission.url) is not None:
|
||||||
details['postType'] = 'direct'
|
details['postType'] = 'direct'
|
||||||
|
details['postURL'] = isDirectLink(submission.url)
|
||||||
directCount += 1
|
directCount += 1
|
||||||
return details
|
return details
|
||||||
|
|
||||||
@@ -435,7 +436,7 @@ def printSubmission(SUB,validNumber,totalNumber):
|
|||||||
|
|
||||||
def isDirectLink(URL):
|
def isDirectLink(URL):
|
||||||
"""Check if link is a direct image link.
|
"""Check if link is a direct image link.
|
||||||
If so, return True,
|
If so, return URL,
|
||||||
if not, return False
|
if not, return False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -444,10 +445,13 @@ def isDirectLink(URL):
|
|||||||
URL = URL[:-1]
|
URL = URL[:-1]
|
||||||
|
|
||||||
if "i.reddituploads.com" in URL:
|
if "i.reddituploads.com" in URL:
|
||||||
return True
|
return URL
|
||||||
|
|
||||||
|
elif "v.redd.it" in URL:
|
||||||
|
return URL+"/DASH_600_K"
|
||||||
|
|
||||||
for extension in imageTypes:
|
for extension in imageTypes:
|
||||||
if extension in URL:
|
if extension in URL:
|
||||||
return True
|
return URL
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user