Merge branch 'master' into changePostNames

This commit is contained in:
Ali Parlakçı 2018-07-24 19:33:38 +03:00 committed by GitHub
commit 3ea2e16b62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 14 deletions

View File

@ -6,9 +6,9 @@ This program downloads imgur, gfycat and direct image and video links of saved p
## What it can do
- Can get posts from: frontpage, subreddits, multireddits, redditor's submissions, upvoted and saved posts; search results or just plain reddit links
- Sorts posts by hot, top, new and so on
- Downloads **REDDIT** images and videos, **IMGUR** images and albums, **GFYCAT** links, **EROME** images and albums, **SELF POSTS** and any link to a direct image
- Downloads **REDDIT** images and videos, **IMGUR** images and albums, **GFYCAT** links, **EROME** images and albums, **SELF POSTS** and any link to a **DIRECT IMAGE**
- Skips the existing ones
- Puts post titles to file's name
- Puts post title and OP's name in file's name
- Puts every post to its subreddit's folder
- Saves a reusable copy of posts' details that are found so that they can be re-downloaded again
- Logs failed ones in a file to so that you can try to download them later
@ -52,6 +52,10 @@ It should redirect to a page which shows your **imgur_client_id** and **imgur_cl
them, there.
## Changes on *master*
### [24/07/2018](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/21533bb78ce24359eb638991f3ec79a572a4a555)
- Deleted # char from file names
- Imroved exception handling
### [23/07/2018](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/7314e17125aa78fd4e6b28e26fda7ec7db7e0147)
- Split download() function
- Added erome support

View File

@ -561,12 +561,26 @@ def download(submissions):
sys.exit()
except ImgurLimitError as exception:
FAILED_FILE.add({int(i+1):[str(exception),submissions[i]]})
FAILED_FILE.add({int(i+1):[
"{class_name}: {info}".format(
class_name=exception.__class__.__name__,info=str(exception)
),
submissions[i]
]})
downloadedCount -= 1
except NotADownloadableLinkError as exception:
print(exception)
FAILED_FILE.add({int(i+1):[str(exception),submissions[i]]})
print(
"{class_name}: {info}".format(
class_name=exception.__class__.__name__,info=str(exception)
)
)
FAILED_FILE.add({int(i+1):[
"{class_name}: {info}".format(
class_name=exception.__class__.__name__,info=str(exception)
),
submissions[i]
]})
downloadedCount -= 1
except NoSuitablePost:
@ -575,8 +589,17 @@ def download(submissions):
except Exception as exception:
# raise exception
print(exception)
FAILED_FILE.add({int(i+1):[str(exception),submissions[i]]})
print(
"{class_name}: {info}".format(
class_name=exception.__class__.__name__,info=str(exception)
)
)
FAILED_FILE.add({int(i+1):[
"{class_name}: {info}".format(
class_name=exception.__class__.__name__,info=str(exception)
),
submissions[i]
]})
downloadedCount -= 1
if duplicates:
@ -602,9 +625,6 @@ def main():
checkConflicts()
except ProgramModeError as err:
PromptUser()
except Exception as err:
print(err)
sys.exit()
if not Path(GLOBAL.configDirectory).is_dir():
os.makedirs(GLOBAL.configDirectory)

View File

@ -142,9 +142,16 @@ class Erome:
howManyDownloaded -= 1
except Exception as exception:
raise exception
# raise exception
print("\n Could not get the file")
print(" " + str(exception) + "\n")
print(
" "
+ "{class_name}: {info}".format(
class_name=exception.__class__.__name__,
info=str(exception)
)
+ "\n"
)
exceptionType = exception
howManyDownloaded -= 1
@ -304,7 +311,14 @@ class Imgur:
except Exception as exception:
print("\n Could not get the file")
print(" " + str(exception) + "\n")
print(
" "
+ "{class_name}: {info}".format(
class_name=exception.__class__.__name__,
info=str(exception)
)
+ "\n"
)
exceptionType = exception
howManyDownloaded -= 1

View File

@ -132,7 +132,7 @@ def nameCorrector(string):
if len(string.split('\n')) > 1:
string = "".join(string.split('\n'))
BAD_CHARS = ['\\','/',':','*','?','"','<','>','|','.',]
BAD_CHARS = ['\\','/',':','*','?','"','<','>','|','.','#']
if any(x in string for x in BAD_CHARS):
for char in string: