9 Commits

Author SHA1 Message Date
Ali Parlakci
80546d7094 Update version 2018-07-25 11:36:58 +03:00
Ali Parlakci
139a81a0e7 Merge branch 'master' of https://github.com/aliparlakci/bulk-downloader-for-reddit 2018-07-25 09:29:48 +03:00
Ali Parlakci
9bb0a5da7f Added delays for imgur rate limit 2018-07-25 09:27:41 +03:00
Ali Parlakçı
6f2273f182 Add file name formatting doc 2018-07-24 23:41:02 +03:00
Ali Parlakci
b5d6165802 Update version 2018-07-24 22:13:38 +03:00
Ali Parlakci
b98815376f Bug fix 2018-07-24 22:13:11 +03:00
Ali Parlakci
d9586f99b8 Use else in try blocks 2018-07-24 22:11:12 +03:00
Ali Parlakci
76711892a2 Merge branch 'master' of https://github.com/aliparlakci/bulk-downloader-for-reddit 2018-07-24 22:10:28 +03:00
Ali Parlakci
bfea548eab Print credits in the same line 2018-07-24 22:10:19 +03:00
3 changed files with 19 additions and 10 deletions

View File

@@ -41,6 +41,13 @@ 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
### 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]**
- An image in an imgur album is formatted as **`[ITEM NUMBER]_[IMAGE TITLE]_[IMGUR ID]`**
Similarly, you can use *imgur id* to go to image's imgur page by going to link **imgur.com/[IMGUR ID]**.
### How do I open self post files?
- Self posts are held at reddit as styled with markdown. So, the script downloads them as they are in order not to lose their stylings.
However, there is a [great Chrome extension](https://chrome.google.com/webstore/detail/markdown-viewer/ckkdlimhmcjmikdlpkmbgfkaikojcbjk) for viewing Markdown files with its styling. Install it and open the files with [Chrome](https://www.google.com/intl/tr/chrome/).

View File

@@ -22,7 +22,7 @@ from src.tools import (GLOBAL, createLogFile, jsonFile, nameCorrector,
__author__ = "Ali Parlakci"
__license__ = "GPL"
__version__ = "1.5.0"
__version__ = "1.5.1.1"
__maintainer__ = "Ali Parlakci"
__email__ = "parlakciali@gmail.com"
@@ -467,11 +467,11 @@ def downloadPost(SUBMISSION):
if SUBMISSION['postType'] in downloaders:
print(SUBMISSION['postType'].upper())
print(SUBMISSION['postType'].upper(),end=" ")
if SUBMISSION['postType'] == "imgur":
if int(time.time() - lastRequestTime) <= 2:
while int(time.time() - lastRequestTime) <= 2:
pass
credit = Imgur.get_credits()
@@ -484,11 +484,11 @@ def downloadPost(SUBMISSION):
+ " Seconds")
print(
"Client: {} - User: {} - Reset {}".format(
"==> Client: {} - User: {} - Reset {}".format(
credit['ClientRemaining'],
credit['UserRemaining'],
USER_RESET
)
),end=""
)
if not (credit['UserRemaining'] == 0 or \
@@ -496,7 +496,7 @@ def downloadPost(SUBMISSION):
"""This block of code is needed
"""
if int(time.time() - lastRequestTime) <= 2:
while int(time.time() - lastRequestTime) <= 2:
pass
lastRequestTime = time.time()
@@ -509,6 +509,7 @@ def downloadPost(SUBMISSION):
raise ImgurLimitError('{} LIMIT EXCEEDED\n'.format(KEYWORD.upper()))
print()
downloaders[SUBMISSION['postType']] (directory,SUBMISSION)
else:

View File

@@ -61,13 +61,14 @@ def getFile(fileDir,tempDir,imageURL,indent=0):
tempDir,
reporthook=dlProgress)
os.rename(tempDir,fileDir)
print(" "*indent+"Downloaded"+" "*10)
break
except ConnectionResetError as exception:
print(" "*indent + str(exception))
print(" "*indent + "Trying again\n")
except FileNotFoundError:
raise FileNameTooLong
else:
print(" "*indent+"Downloaded"+" "*10)
break
else:
raise FileAlreadyExistsError
@@ -90,10 +91,10 @@ class Erome:
print(post["postSubmitter"]+"_"+title+"_"+post['postId']+extension)
fileDir = directory / (
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+extension
post["postSubmitter"]+"_"+title+"_"+post['postId']+extension
)
tempDir = directory / (
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+".tmp"
post["postSubmitter"]+"_"+title+"_"+post['postId']+".tmp"
)
imageURL = "https:" + IMAGES[0]