|
|
@ -56,10 +56,18 @@ item = config.get('main', 'item')
|
|
|
|
whitelist_distinguished = config.getboolean('main', 'whitelist_distinguished')
|
|
|
|
whitelist_distinguished = config.getboolean('main', 'whitelist_distinguished')
|
|
|
|
whitelist_gilded = config.getboolean('main', 'whitelist_gilded')
|
|
|
|
whitelist_gilded = config.getboolean('main', 'whitelist_gilded')
|
|
|
|
nuke_hours = config.getint('main', 'nuke_hours')
|
|
|
|
nuke_hours = config.getint('main', 'nuke_hours')
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
max_score = config.getint('main', 'max_score')
|
|
|
|
|
|
|
|
except ValueError:
|
|
|
|
|
|
|
|
max_score = None
|
|
|
|
|
|
|
|
save_directory = config.get('main', 'save_directory')
|
|
|
|
|
|
|
|
|
|
|
|
_user = config.get('main', 'username')
|
|
|
|
_user = config.get('main', 'username')
|
|
|
|
_pass = config.get('main', 'password')
|
|
|
|
_pass = config.get('main', 'password')
|
|
|
|
|
|
|
|
|
|
|
|
r = praw.Reddit(user_agent="shreddit/3.3")
|
|
|
|
r = praw.Reddit(user_agent="shreddit/3.3")
|
|
|
|
|
|
|
|
if save_directory:
|
|
|
|
|
|
|
|
r.config.store_json_result = True
|
|
|
|
|
|
|
|
|
|
|
|
def login(user=None, password=None):
|
|
|
|
def login(user=None, password=None):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -123,15 +131,24 @@ for thing in things:
|
|
|
|
thing.id in whitelist_ids:
|
|
|
|
thing.id in whitelist_ids:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if whitelist_distinguished and thing.distinguished:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
if whitelist_gilded and thing.gilded:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
if max_score is not None and thing.score > max_score:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
if trial_run: # Don't do anything, trial mode!
|
|
|
|
if trial_run: # Don't do anything, trial mode!
|
|
|
|
if verbose:
|
|
|
|
if verbose:
|
|
|
|
print("Would have deleted {thing}: '{content}'".format(
|
|
|
|
print("Would have deleted {thing}: '{content}'".format(
|
|
|
|
thing=thing.id, content=thing))
|
|
|
|
thing=thing.id, content=thing))
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
if whitelist_distinguished and thing.distinguished:
|
|
|
|
|
|
|
|
continue
|
|
|
|
if save_directory:
|
|
|
|
if whitelist_gilded and thing.gilded:
|
|
|
|
if not os.path.exists(save_directory):
|
|
|
|
continue
|
|
|
|
os.makedirs(save_directory)
|
|
|
|
|
|
|
|
with open("%s/%s.json" % (save_directory, thing.id), "w") as fh:
|
|
|
|
|
|
|
|
json.dump(thing.json_dict, fh)
|
|
|
|
|
|
|
|
|
|
|
|
if clear_vote:
|
|
|
|
if clear_vote:
|
|
|
|
thing.clear_vote()
|
|
|
|
thing.clear_vote()
|
|
|
|