13 Commits

Author SHA1 Message Date
b782b2b568 Updated README and docs/COMMAND_LINE_ARGUMENTS w/ downvoted parameter. 2019-12-23 01:21:44 +01:00
da13a2f14c If downvoted exists in args then try fetch downvoted posts from reddit user. 2019-12-23 01:20:36 +01:00
289418b485 Downvote argument should have a user parameter and is not supposed to be searchable. 2019-12-23 01:17:47 +01:00
f32d17796a Downvoted argument added to ./script.py's parser, programMode and Attributes dictonary. 2019-12-23 01:16:43 +01:00
Ali Parlakçı
d6194c57d9 Merge pull request #67 from dbanon87/dbanon87/erome-downloads
fix erome download URLs
2019-10-17 09:51:02 +03:00
Ali Parlakçı
cd87a4a120 Merge pull request #68 from dbanon87/dbanon87/gitignore-env
add env/ to gitignore
2019-10-17 09:49:36 +03:00
dbanon87
08cddf4c83 add env/ to gitignore
This allows working in a virtualenv in the project directory.
2019-10-08 10:52:56 -04:00
dbanon87
88fa9e742d fix erome download URLs 2019-10-08 10:51:56 -04:00
Ali Parlakçı
1c17f174a8 typo 2019-04-23 17:00:42 +03:00
Ali Parlakçı
9b36336ac3 typo 2019-04-23 16:51:05 +03:00
Ali Parlakçı
35e551f20c Update README.md 2019-04-23 14:04:15 +03:00
Ali Parlakçı
0f2bda9c34 Merge pull request #63 from aliparlakci/moreUsefulReadme
A more useful readme (credits to *stared*)
2019-04-23 14:00:53 +03:00
Ali Parlakçı
8ab694bcc1 Fixed typo 2019-04-23 13:59:01 +03:00
8 changed files with 63 additions and 15 deletions

3
.gitignore vendored
View File

@@ -3,4 +3,5 @@ dist/
MANIFEST
__pycache__/
src/__pycache__/
config.json
config.json
env/

View File

@@ -2,9 +2,11 @@
Downloads media from reddit posts. Made by [u/aliparlakci](https://reddit.com/u/aliparlakci)
## [Download the latest release here](https://github.com/aliparlakci/bulk-downloader-for-reddit/releases/latest)
## 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
@@ -19,7 +21,7 @@ You can use it either as a `bulk-downloader-for-reddit.exe` executable file for
### Executables
For Windows and Linux, [download the latest release, here](https://github.com/aliparlakci/bulk-downloader-for-reddit/releases/latest).
For Windows and Linux, [download the latest executables, here](https://github.com/aliparlakci/bulk-downloader-for-reddit/releases/latest).
### Python script
@@ -45,7 +47,7 @@ You can run it it an interactive mode, or using [command-line arguments](docs/CO
To run the interactive mode, simply use `python ./script.py` or double click on `bulk-downloader-for-reddit.exe` without any extra commands.
### [Example for command line arguemnts](docs/COMMAND_LINE_ARGUMENTS.md#examples)
### [Example for command line arguments](docs/COMMAND_LINE_ARGUMENTS.md#examples)
### Example for an interactive script
@@ -65,7 +67,8 @@ select program mode:
[3] multireddit
[4] submitted
[5] upvoted
[6] saved
[6] downvoted
[7] saved
[7] log
[0] exit
@@ -109,7 +112,7 @@ Press enter to quit
## FAQ
### I am running the script on an headless machine or a remote server. How can I authenticate my reddit account?
### I am running the script on a headless machine or on a remote server. How can I authenticate my reddit account?
- Download the script on your everday computer and run it for once.
- Authenticate the program on both reddit and imgur.
- Go to your Home folder (for Windows users it is `C:\Users\[USERNAME]\`, for Linux users it is `/home/[USERNAME]`)

View File

@@ -1,5 +1,5 @@
# Changes on *master*
##[23/02/2019](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/4d385fda60028343be816eb7c4f7bc613a9d555d)
## [23/02/2019](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/4d385fda60028343be816eb7c4f7bc613a9d555d)
- Fixed v.redd.it links
## [27/01/2019](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/b7baf07fb5998368d87e3c4c36aed40daf820609)
@@ -83,4 +83,4 @@
## [10/07/2018](https://github.com/aliparlakci/bulk-downloader-for-reddit/tree/ffe3839aee6dc1a552d95154d817aefc2b66af81)
- Added support for *self* post
- Now getting posts is quicker
- Now getting posts is quicker

View File

@@ -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 ...]

View File

@@ -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

View File

@@ -117,7 +117,9 @@ class Erome:
post["postSubmitter"]+"_"+title+"_"+post['postId']+".tmp"
)
imageURL = "https:" + IMAGES[0]
imageURL = IMAGES[0]
if 'https://' not in imageURL and 'http://' not in imageURL:
imageURL = "https://" + imageURL
try:
getFile(fileDir,tempDir,imageURL)
@@ -146,7 +148,9 @@ class Erome:
extension = getExtension(IMAGES[i])
fileName = str(i+1)
imageURL = "https:" + IMAGES[i]
imageURL = IMAGES[i]
if 'https://' not in imageURL and 'http://' not in imageURL:
imageURL = "https://" + imageURL
fileDir = folderDir / (fileName + extension)
tempDir = folderDir / (fileName + ".tmp")

View File

@@ -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"]

View File

@@ -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(