-
Notifications
You must be signed in to change notification settings - Fork 78
Adaptation to Python 3, new features, bug fixes #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jtara1
wants to merge
46
commits into
HoverHell:master
Choose a base branch
from
jtara1:merge-ready
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
563c140
Perform 2to3
ohyou 56b361d
Make it work as a module
ohyou 2a4477e
Remove unnecessary output
ohyou 60f0856
Fix errors when downloading from gfycat
ohyou 236a592
Handle some errors
ohyou 8c1311f
update .gitignore
jtara1 ab18926
Merge https://github.com/ohyou/RedditImageGrab
jtara1 bf02892
downloads imgur imgs using jtara1/imgur-album-downloader
jtara1 0edcfb3
fix func names & update .gitignore
jtara1 75f4c8b
fix slugify func so --filename-format arg works
jtara1 3d29e43
added func to make cleaner filename, update readme
jtara1 1758e32
updates & fixes, func process_deviant_url works, & ImgurDownloader up…
jtara1 9258a07
new feature, last-id tracking in file '._history.txt'
jtara1 d32ca53
new feature, load subreddits from subreddits text file and process ea…
jtara1 b401526
update readme.md & add todo.md
jtara1 1c85413
fix, [--subreddit-list srl] and [--dir <dest_file>] work properly now
jtara1 0186590
update DOWNLOADED, ERRORS, & other vars to keep track of progress
jtara1 2c5321d
update readme
jtara1 167e5df
critical fix, parse_subreddit_list will now break main loop when newl…
jtara1 6539870
critical fix, --subreddits-list arg and everything else should be wor…
jtara1 e90d53d
parse_subreddit_list.py now skips iteration (continue) when line=='\n'
jtara1 82a89d8
reorganized loop to handle subreddits more clearly, changed user-agen…
jtara1 839fc57
update readme & todo
jtara1 72a60b9
fix ARGS.num checker, update readme
jtara1 af0b953
update readme
jtara1 3361953
add jtara1/imgur-downloader repository
jtara1 28bf0d1
added jtara1/imgur-downloader & rm test imgs
jtara1 ec208d5
update, rename some files
jtara1 a3c430c
CRIT FIXES: url corrected in reddit.py, PROG_REPORT variables corrected
jtara1 90e6860
update
jtara1 1cd0764
hot fix for gfycat & printing is more helpful
jtara1 3517e8d
update readme
jtara1 5a92db0
update readme
jtara1 ba4e8e6
fix gfycat downloading, Does Not Exist errors are handled properly now
jtara1 9177594
update txt
jtara1 8c9be20
update readme
jtara1 eeb204e
update imgur-downloader
jtara1 3426c5d
rm imgur-downloader/readme.md
jtara1 8e4787e
add subreddit list examples
jtara1 e113d2c
update history_log, cli args, readme, & vars renamed
jtara1 ab53b4a
new cli arg, --restart (begins downloading from beginning of subreddit
jtara1 f9a27f1
update readme, todo, minor fixes
jtara1 ef89c68
update history_log func, imports relocated in gfycat.py
jtara1 2c9ffda
update parse_subreddit_list, CRIT FIX: imgur-downloader
jtara1 5399043
update imgur-downloader docstrings
jtara1 ddf0745
hotfix for when last ITEM is comment thread (caused infinite looping)
jtara1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,20 @@ | ||
| */*.jpg | ||
| */*.png | ||
| */*.webm | ||
| */*.mp4 | ||
| *.swp | ||
| *.bak | ||
| *.DS_Store | ||
| *.sh | ||
| *.pyc | ||
| /.idea | ||
|
|
||
| venv/* | ||
|
|
||
| /.project | ||
| /*~ | ||
| /*.webm | ||
| /gfycat | ||
| /build | ||
| /.pydevproject | ||
|
|
||
| cli.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,15 +8,56 @@ fresh and interesting. The main idea is that the script would download | |
| any JPEG or PNG formatted image that it found listed in the specified | ||
| subreddit and download them to a folder. | ||
|
|
||
| ## jtara1 Fork | ||
|
|
||
| # Requirements: | ||
| ### Features and Changes: | ||
|
|
||
| * Python 2 (Python3 might be supported over 2to3, but see for | ||
| yourself and report back). | ||
| * Optional requirements: listed in setup.py under extras_require. | ||
|
|
||
|
|
||
| # Usage: | ||
| * Adapted to Python 3 mostly by merge from [ohyou/RedditImageGrab](https://github.com/ohyou/RedditImageGrab) along with some additional fixes | ||
|
|
||
| * \-\-num cli argument now counts by reddit submission rather than individual image | ||
|
|
||
| * added submodule `imgur-downloader` which enabled the above feature among other things | ||
|
|
||
|
|
||
| * file `._history.txt` contains reddit id of last downloaded and is identified by `subreddit` & `ARGS.sort_type`, e.g.: | ||
|
|
||
| > {'wallpapers': {'topmonth': {'last\-id': '4x4so2'}}} | ||
|
|
||
| * positional argument, `<subreddit>`, can now autodetect whether value points to subreddit name or subreddit list file | ||
|
|
||
|
|
||
| * `--subreddit-list srl-filename` cli argument added where srl is the filename containing list of subreddits to process | ||
|
|
||
| * added function to process subreddit list for subreddit links & associated save location for each | ||
|
|
||
| * at this time, the same cli arguments are used for all subreddits in list, but save folder can be altered | ||
|
|
||
| * examples for subreddits.txt added, in folder `subreddit-list-examples` | ||
|
|
||
| * updated progress report variables such as DOWNLOADED and ERRORS to accommodate for processing a list of subreddits | ||
|
|
||
| * `--restart` cli arg added which begins downloading from the beginning of the subreddit rather than resuming from last download ID. | ||
|
|
||
| ### Fixes: | ||
|
|
||
| * `--filename-format` cli arg should work as expected | ||
|
|
||
| * `gfycat.py` failed to download direct links to .webm & .mp4 files | ||
|
|
||
| * `gfycat.py` failed to process gfycat links that did not exist | ||
|
|
||
| ## Issues | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rather than issue, maybe todo? |
||
|
|
||
| * needs more testing | ||
|
|
||
| ## Requirements: | ||
|
|
||
| * Python 3 | ||
| * Optional requirements: listed in setup.py under extras_require. | ||
|
|
||
| ## Usage: | ||
|
|
||
| See `./redditdl.py --help` for uptodate details. | ||
|
|
||
|
|
@@ -33,14 +74,16 @@ ordering = ('key', ) | |
|
|
||
| Downloads files with specified extension from the specified subreddit. | ||
|
|
||
| positional arguments: | ||
| main arguments: | ||
|
|
||
| <subreddit> Subreddit name. | ||
| <dest_file> Dir to put downloaded files in. | ||
| subreddit <subreddit> Subreddit or subreddit list file name. | ||
| dir <dest_file> Dir to put downloaded files in. | ||
|
|
||
| optional arguments: | ||
|
|
||
| -h, --help show this help message and exit | ||
| --subbreddit-list srl-filename | ||
| Take a list of subreddits from a text file, srl = subreddits.txt | ||
| --multireddit Take multirredit instead of subreddit as input. If so, | ||
| provide /user/m/multireddit-name as argument | ||
| --last l ID of the last downloaded file. | ||
|
|
@@ -54,43 +97,43 @@ optional arguments: | |
| --skipAlbums Skip all albums | ||
| --mirror-gfycat Download available mirror in gfycat.com. | ||
| --filename-format FILENAME_FORMAT | ||
| Specify filename format: reddit (default), title or | ||
| url | ||
| Specify filename format: reddit (default), title or url | ||
| --sort-type Sort the subreddit. | ||
| --restart Begin downloading from beginning of subreddit rather than resuming from last dl subreddit submission. | ||
|
|
||
|
|
||
| # Examples | ||
| ## Examples | ||
|
|
||
| An example of running this script to download images with a score | ||
| greater than 50 from the wallpaper sub-reddit into a folder called | ||
| wallpaper would be as follows: | ||
|
|
||
| python redditdl.py wallpaper wallpaper --score 50 | ||
| python3 redditdl.py wallpaper wallpaper --score 50 | ||
|
|
||
| And to run the same query but only get new images you don't already | ||
| have, run the following: | ||
|
|
||
| python redditdl.py wallpaper wallpaper --score 50 -update | ||
| python3 redditdl.py wallpaper wallpaper --score 50 -update | ||
|
|
||
| For getting some nice pictures of cats in your catsfolder (wich will be created if it | ||
| doesn't exist yet) run: | ||
|
|
||
| python redditdl.py cats ~/Pictures/catsfolder --score 1000 --num 5 --sfw --verbose | ||
| python3 redditdl.py cats ~/Pictures/catsfolder --score 1000 --num 5 --sfw --verbose | ||
|
|
||
|
|
||
| ## Advanced Examples | ||
| ### Advanced Examples | ||
|
|
||
| Retrieve last 10 pics in the 'wallpaper' subreddit with the word | ||
| Retrieve pics from last 10 submission in the 'wallpaper' subreddit with the word | ||
| "sunset" in the title (note: case is ignored by (?i) predicate) | ||
|
|
||
| python redditdl.py wallpaper sunsets --regex '(?i).*sunset.*' --num 10 | ||
| python3 redditdl.py wallpaper sunsets --regex '(?i).*sunset.*' --num 10 | ||
|
|
||
| Download top week post from subreddit 'animegifs' and use gfycat gif mirror (if available) | ||
|
|
||
| python redditdl.py animegifs --sort-type topweek --mirror-gfycat | ||
| python3 redditdl.py animegifs --sort-type topweek --mirror-gfycat | ||
|
|
||
|
|
||
| ## Sorting | ||
| ### Sorting | ||
|
|
||
| Available sorting are following : hot, new, rising, controversial, top, gilded | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ## todo | ||
|
|
||
| * fix downloading from deviantart, tubmlr, pixiv.net, instagram & other sites | ||
|
|
||
| * record metadata (submission link & comments, local file location) in database | ||
|
|
||
| * integrate youtube-dl module to handle all video links |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,4 @@ | |
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| main() | ||
| main("") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .DS_Store | ||
| test.py | ||
| *.pyc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Copyright (C) 2012 Alex Gisby | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only for fork