Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json, requests, time, praw, getpass, random, string
- user = raw_input("Username: ")
- redd = praw.Reddit(client_id='', # Reddit's ID for your application
- client_secret='', # Reddit's secret key for that application
- user_agent='', # Can be whatever you want
- username=user,
- password=getpass.getpass())
- keep_history = 5
- me = redd.redditor(user)
- def show_comments(acct):
- comments = acct.comments.new(limit=None)
- comments = list(reversed(list(comments)))
- print("Found total of: " + str(len(comments)) + " comments.")
- first_com = comments[0].body.split('\n', 1)[0][:79]
- last_com = comments[(len(comments) - keep_history)].body.split('\n', 1)[0][:79]
- print("First to be deleted: \n\n" + str(first_com))
- print("Last to be deleted: \n\n" + str(last_com))
- def bunkify_old_comments(acct):
- comments = acct.comments.new(limit=None)
- comments = list(reversed(list(comments)))
- print("Found total of: " + str(len(comments)) + " comments.")
- for i in range((len(comments) - keep_history)):
- rand = ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(2096)])
- print("Attempting to edit comment with " + str(rand))
- comments[i].edit(rand)
- def delete_old_comments(acct):
- comments = acct.comments.new(limit=None)
- comments = list(reversed(list(comments)))
- print("Found total of: " + str(len(comments)) + " comments.")
- for i in range((len(comments) - keep_history)):
- print("Attempting to delete comment... " + str(comments[i].fullname))
- comments[i].delete()
- def repeat_bunkify(num, sleep):
- print("Repeating edits " + str(num) + " times.\n")
- for i in range(1, num):
- print("Executing cycle " + str(i) + " out of " + str(num) + ".\n")
- bunkify_old_comments(me)
- print("Sleeping for " + str(sleep) + " seconds...")
- tenth = sleep / 10
- total_slept = 0
- for i in range(1, 10):
- time.sleep(tenth)
- cycles_remain = 10 - i
- secs_remain = cycles_remain * tenth
- print("... " + str(secs_remain) + " seconds left in sleep...")
- def full_cycle(cycles, sleep):
- repeat_bunkify(cycles, sleep)
- delete_old_comments(me)
- #show_comments(me)
- full_cycle(500, 1270)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement