Skip to content
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

Skip albums flag and redditdownload.py improvements #23

Merged
merged 2 commits into from Oct 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions redditdownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def process_imgur_url(url):
Returns:
list of imgur URLs
"""
if 'imgur.com/a/' in url:
if 'imgur.com/a/' in url or 'imgur.com/gallery/' in url:
return extract_imgur_album_urls(url)

# Change .png to .jpg for imgur urls.
Expand Down Expand Up @@ -212,6 +212,7 @@ def extract_urls(url):
PARSER.add_argument('-nsfw', default=False, action='store_true', required=False, help='Download NSFW images only.')
PARSER.add_argument('-regex', default=None, action='store', required=False, help='Use Python regex to filter based on title.')
PARSER.add_argument('-verbose', default=False, action='store_true', required=False, help='Enable verbose output.')
PARSER.add_argument('-skipAlbums', default=False, action='store_true', required=False, help='Skip all albums')
ARGS = PARSER.parse_args()

print 'Downloading images from "%s" subreddit' % (ARGS.reddit)
Expand All @@ -238,7 +239,10 @@ def extract_urls(url):

for ITEM in ITEMS:
TOTAL += 1


if 'reddit.com/r/' + ARGS.reddit + '/comments/' in ITEM['url']:
continue

if ITEM['score'] < ARGS.score:
if ARGS.verbose:
print ' SCORE: %s has score of %s which is lower than required score of %s.' % (ITEM['id'], ITEM['score'], ARGS.score)
Expand All @@ -263,6 +267,12 @@ def extract_urls(url):

SKIPPED += 1
continue
elif ARGS.skipAlbums and 'imgur.com/a/' in ITEM['url']:
if ARGS.verbose:
print ' Album found, skipping %s' % (ITEM['id'])

SKIPPED += 1
continue

FILECOUNT = 0
URLS = extract_urls(ITEM['url'])
Expand Down