mirror of
https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
synced 2026-01-10 19:25:41 +00:00
Compare commits
4 Commits
master
...
feature/us
| Author | SHA1 | Date | |
|---|---|---|---|
| b782b2b568 | |||
| da13a2f14c | |||
| 289418b485 | |||
| f32d17796a |
@@ -6,7 +6,7 @@ Downloads media from reddit posts. Made by [u/aliparlakci](https://reddit.com/u/
|
||||
|
||||
## 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
|
||||
- Can get posts from: frontpage, subreddits, multireddits, redditor's submissions, upvoted, downvoted 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**
|
||||
- Skips the existing ones
|
||||
@@ -67,7 +67,8 @@ select program mode:
|
||||
[3] multireddit
|
||||
[4] submitted
|
||||
[5] upvoted
|
||||
[6] saved
|
||||
[6] downvoted
|
||||
[7] saved
|
||||
[7] log
|
||||
[0] exit
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ See **[compiling from source](INTERPRET_FROM_SOURCE.md)** page first unless you
|
||||
***Use*** `.\bulk-downloader-for-reddit.exe` ***or*** `./bulk-downloader-for-reddit` ***if you are using the executable***.
|
||||
```console
|
||||
$ python script.py --help
|
||||
usage: script.py [-h] [--directory DIRECTORY] [--NoDownload] [--verbose]
|
||||
[--quit] [--link link] [--saved] [--submitted] [--upvoted]
|
||||
usage: script.py [-h] [--directory DIRECTORY] [--NoDownload] [--verbose] [--quit]
|
||||
[--link link] [--saved] [--submitted] [--upvoted] [--downvoted]
|
||||
[--log LOG FILE] [--subreddit SUBREDDIT [SUBREDDIT ...]]
|
||||
[--multireddit MULTIREDDIT] [--user redditor]
|
||||
[--search query] [--sort SORT TYPE] [--limit Limit]
|
||||
@@ -27,6 +27,7 @@ optional arguments:
|
||||
--saved Triggers saved mode
|
||||
--submitted Gets posts of --user
|
||||
--upvoted Gets upvoted posts of --user
|
||||
--downvoted Gets downvoted posts of --user
|
||||
--log LOG FILE Takes a log file which created by itself (json files),
|
||||
reads posts and tries downloading them again.
|
||||
--subreddit SUBREDDIT [SUBREDDIT ...]
|
||||
|
||||
22
script.py
22
script.py
@@ -114,6 +114,10 @@ def parseArguments(arguments=[]):
|
||||
action="store_true",
|
||||
help="Gets upvoted posts of --user")
|
||||
|
||||
parser.add_argument("--downvoted",
|
||||
action="store_true",
|
||||
help="Gets downvoted posts of --user")
|
||||
|
||||
parser.add_argument("--log",
|
||||
help="Takes a log file which created by itself " \
|
||||
"(json files), reads posts and tries downloadin" \
|
||||
@@ -187,7 +191,7 @@ def checkConflicts():
|
||||
search = 1 if GLOBAL.arguments.search else 0
|
||||
|
||||
modes = [
|
||||
"saved","subreddit","submitted","log","link","upvoted","multireddit"
|
||||
"saved","subreddit","submitted","log","link","upvoted","downvoted","multireddit"
|
||||
]
|
||||
|
||||
values = {
|
||||
@@ -209,12 +213,19 @@ def checkConflicts():
|
||||
if search+values["upvoted"] == 2:
|
||||
raise SearchModeError("You cannot search in upvoted posts")
|
||||
|
||||
if search+values["downvoted"] == 2:
|
||||
raise SearchModeError("You cannot search in downvoted posts")
|
||||
|
||||
if search+values["log"] == 2:
|
||||
raise SearchModeError("You cannot search in log files")
|
||||
|
||||
if values["upvoted"]+values["submitted"] == 1 and user == 0:
|
||||
raise RedditorNameError("No redditor name given")
|
||||
|
||||
if values["downvoted"]+values["submitted"] == 1 and user == 0:
|
||||
raise RedditorNameError("No redditor name given")
|
||||
|
||||
|
||||
class PromptUser:
|
||||
@staticmethod
|
||||
def chooseFrom(choices):
|
||||
@@ -241,7 +252,7 @@ class PromptUser:
|
||||
print("select program mode:")
|
||||
programModes = [
|
||||
"search","subreddit","multireddit",
|
||||
"submitted","upvoted","saved","log"
|
||||
"submitted","upvoted","downvoted","saved","log"
|
||||
]
|
||||
programMode = self.chooseFrom(programModes)
|
||||
|
||||
@@ -345,6 +356,10 @@ class PromptUser:
|
||||
elif programMode == "upvoted":
|
||||
GLOBAL.arguments.upvoted = True
|
||||
GLOBAL.arguments.user = input("\nredditor: ")
|
||||
|
||||
elif programMode == "downvoted":
|
||||
GLOBAL.arguments.downvoted = True
|
||||
GLOBAL.arguments.user = input("\nredditor: ")
|
||||
|
||||
elif programMode == "saved":
|
||||
GLOBAL.arguments.saved = True
|
||||
@@ -419,6 +434,9 @@ def prepareAttributes():
|
||||
elif GLOBAL.arguments.upvoted is True:
|
||||
ATTRIBUTES["upvoted"] = True
|
||||
|
||||
elif GLOBAL.arguments.downvoted is True:
|
||||
ATTRIBUTES["downvoted"] = True
|
||||
|
||||
elif GLOBAL.arguments.submitted is not None:
|
||||
ATTRIBUTES["submitted"] = True
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ def LinkParser(LINK):
|
||||
if index == 0:
|
||||
RESULT["subreddit"] = "frontpage"
|
||||
|
||||
elif SplittedLink[index] in ["submitted","saved","posts","upvoted"]:
|
||||
elif SplittedLink[index] in ["submitted","saved","posts","upvoted","downvoted"]:
|
||||
if SplittedLink[index] == "submitted" or \
|
||||
SplittedLink[index] == "posts":
|
||||
RESULT["submitted"] = {}
|
||||
@@ -103,6 +103,9 @@ def LinkParser(LINK):
|
||||
elif SplittedLink[index] == "upvoted":
|
||||
RESULT["upvoted"] = True
|
||||
|
||||
elif SplittedLink[index] == "downvoted":
|
||||
RESULT["downvoted"] = True
|
||||
|
||||
elif "?" in SplittedLink[index]:
|
||||
ParsedQuery = QueryParser(SplittedLink[index],index)
|
||||
if ParsedQuery["HEADER"] == "search":
|
||||
@@ -119,6 +122,7 @@ def LinkParser(LINK):
|
||||
RESULT["queries"] = ParsedQuery
|
||||
|
||||
if not ("upvoted" in RESULT or \
|
||||
"downvoted" in RESULT or \
|
||||
"saved" in RESULT or \
|
||||
"submitted" in RESULT or \
|
||||
"multireddit" in RESULT) and \
|
||||
@@ -221,6 +225,9 @@ def LinkDesigner(LINK):
|
||||
|
||||
elif "upvoted" in attributes:
|
||||
MODE["upvoted"] = True
|
||||
|
||||
elif "downvoted" in attributes:
|
||||
MODE["downvoted"] = True
|
||||
|
||||
elif "multireddit" in attributes:
|
||||
MODE["multireddit"] = attributes["multireddit"]
|
||||
|
||||
@@ -280,6 +280,20 @@ def getPosts(args):
|
||||
except Forbidden:
|
||||
raise InsufficientPermission("You do not have permission to do that")
|
||||
|
||||
elif "downvoted" in args:
|
||||
print (
|
||||
"downvoted posts of {user}\nlimit: {limit}\n".format(
|
||||
user=args["user"],
|
||||
limit=args["limit"]
|
||||
).upper(),noPrint=True
|
||||
)
|
||||
try:
|
||||
return redditSearcher(
|
||||
reddit.redditor(args["user"]).downvoted(limit=args["limit"])
|
||||
)
|
||||
except Forbidden:
|
||||
raise InsufficientPermission("You do not have permission to do that")
|
||||
|
||||
elif "post" in args:
|
||||
print("post: {post}\n".format(post=args["post"]).upper(),noPrint=True)
|
||||
return redditSearcher(
|
||||
|
||||
Reference in New Issue
Block a user