mirror of
https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
synced 2025-10-29 17:40:15 +00:00
Downvoted argument added to ./script.py's parser, programMode and Attributes dictonary.
This commit is contained in:
15
script.py
15
script.py
@@ -114,6 +114,10 @@ def parseArguments(arguments=[]):
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Gets upvoted posts of --user")
|
help="Gets upvoted posts of --user")
|
||||||
|
|
||||||
|
parser.add_argument("--downvoted",
|
||||||
|
action="store_true",
|
||||||
|
help="Gets downvoted posts of --user")
|
||||||
|
|
||||||
parser.add_argument("--log",
|
parser.add_argument("--log",
|
||||||
help="Takes a log file which created by itself " \
|
help="Takes a log file which created by itself " \
|
||||||
"(json files), reads posts and tries downloadin" \
|
"(json files), reads posts and tries downloadin" \
|
||||||
@@ -187,7 +191,7 @@ def checkConflicts():
|
|||||||
search = 1 if GLOBAL.arguments.search else 0
|
search = 1 if GLOBAL.arguments.search else 0
|
||||||
|
|
||||||
modes = [
|
modes = [
|
||||||
"saved","subreddit","submitted","log","link","upvoted","multireddit"
|
"saved","subreddit","submitted","log","link","upvoted","downvoted","multireddit"
|
||||||
]
|
]
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
@@ -241,7 +245,7 @@ class PromptUser:
|
|||||||
print("select program mode:")
|
print("select program mode:")
|
||||||
programModes = [
|
programModes = [
|
||||||
"search","subreddit","multireddit",
|
"search","subreddit","multireddit",
|
||||||
"submitted","upvoted","saved","log"
|
"submitted","upvoted","downvoted","saved","log"
|
||||||
]
|
]
|
||||||
programMode = self.chooseFrom(programModes)
|
programMode = self.chooseFrom(programModes)
|
||||||
|
|
||||||
@@ -346,6 +350,10 @@ class PromptUser:
|
|||||||
GLOBAL.arguments.upvoted = True
|
GLOBAL.arguments.upvoted = True
|
||||||
GLOBAL.arguments.user = input("\nredditor: ")
|
GLOBAL.arguments.user = input("\nredditor: ")
|
||||||
|
|
||||||
|
elif programMode == "downvoted":
|
||||||
|
GLOBAL.arguments.downvoted = True
|
||||||
|
GLOBAL.arguments.user = input("\nredditor: ")
|
||||||
|
|
||||||
elif programMode == "saved":
|
elif programMode == "saved":
|
||||||
GLOBAL.arguments.saved = True
|
GLOBAL.arguments.saved = True
|
||||||
|
|
||||||
@@ -419,6 +427,9 @@ def prepareAttributes():
|
|||||||
elif GLOBAL.arguments.upvoted is True:
|
elif GLOBAL.arguments.upvoted is True:
|
||||||
ATTRIBUTES["upvoted"] = True
|
ATTRIBUTES["upvoted"] = True
|
||||||
|
|
||||||
|
elif GLOBAL.arguments.downvoted is True:
|
||||||
|
ATTRIBUTES["downvoted"] = True
|
||||||
|
|
||||||
elif GLOBAL.arguments.submitted is not None:
|
elif GLOBAL.arguments.submitted is not None:
|
||||||
ATTRIBUTES["submitted"] = True
|
ATTRIBUTES["submitted"] = True
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ def LinkParser(LINK):
|
|||||||
if index == 0:
|
if index == 0:
|
||||||
RESULT["subreddit"] = "frontpage"
|
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 \
|
if SplittedLink[index] == "submitted" or \
|
||||||
SplittedLink[index] == "posts":
|
SplittedLink[index] == "posts":
|
||||||
RESULT["submitted"] = {}
|
RESULT["submitted"] = {}
|
||||||
@@ -103,6 +103,9 @@ def LinkParser(LINK):
|
|||||||
elif SplittedLink[index] == "upvoted":
|
elif SplittedLink[index] == "upvoted":
|
||||||
RESULT["upvoted"] = True
|
RESULT["upvoted"] = True
|
||||||
|
|
||||||
|
elif SplittedLink[index] == "downvoted":
|
||||||
|
RESULT["downvoted"] = True
|
||||||
|
|
||||||
elif "?" in SplittedLink[index]:
|
elif "?" in SplittedLink[index]:
|
||||||
ParsedQuery = QueryParser(SplittedLink[index],index)
|
ParsedQuery = QueryParser(SplittedLink[index],index)
|
||||||
if ParsedQuery["HEADER"] == "search":
|
if ParsedQuery["HEADER"] == "search":
|
||||||
@@ -119,6 +122,7 @@ def LinkParser(LINK):
|
|||||||
RESULT["queries"] = ParsedQuery
|
RESULT["queries"] = ParsedQuery
|
||||||
|
|
||||||
if not ("upvoted" in RESULT or \
|
if not ("upvoted" in RESULT or \
|
||||||
|
"downvoted" in RESULT or \
|
||||||
"saved" in RESULT or \
|
"saved" in RESULT or \
|
||||||
"submitted" in RESULT or \
|
"submitted" in RESULT or \
|
||||||
"multireddit" in RESULT) and \
|
"multireddit" in RESULT) and \
|
||||||
@@ -222,6 +226,9 @@ def LinkDesigner(LINK):
|
|||||||
elif "upvoted" in attributes:
|
elif "upvoted" in attributes:
|
||||||
MODE["upvoted"] = True
|
MODE["upvoted"] = True
|
||||||
|
|
||||||
|
elif "downvoted" in attributes:
|
||||||
|
MODE["downvoted"] = True
|
||||||
|
|
||||||
elif "multireddit" in attributes:
|
elif "multireddit" in attributes:
|
||||||
MODE["multireddit"] = attributes["multireddit"]
|
MODE["multireddit"] = attributes["multireddit"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user