Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Quick reddit account migration script

Hey everyone, I haven't touched python in a while so I wanted to program a little script to migrate to a new account and wipe the old one (I'm a little paranoid about anonymity). Figured I would post it in hopes of some tips or critique, and maybe someone will find it useful. I also apologize if this isn't the right sub for this, didn't know where to post

import praw
#Account Migration Script
#By:/u/letmelive123
#Date:6/24/2017

#Warning! Using this script will entirely wipe the parent Account.
#To use input accounts and body to replace comments with
#parentAcc is the account being wiped
#secAcc is the account you are moving to
#body is the text that will replace all comments on parentAcc


#This function will transfer new multireddits to the target account.
#Note:We convert 'multi' to str and partition it to extract the multireddit name
#This is because parentAcc.user.multireddits() returns a list of paths to multireddits
def transferMultis():
for multi in parentAcc.user.multireddits():
s = str(multi)
parentAcc.multireddit(name=s.partition("/m/")[2], redditor=parentAcc.user.me()).update(visibility='public')
secAcc.multireddit(name=s.partition("/m/")[2], redditor=parentAcc.user.me()).copy(display_name=None)
parentAcc.multireddit(name=s.partition("/m/")[2],redditor=parentAcc.user.me()).delete()


#This function will transfer new multireddits to the target account.
def transferSubs():
for sub in parentAcc.user.subreddits():
s = str(sub)
secAcc.subreddit(s).subscribe()
parentAcc.subreddit(s).unsubscribe()

#This function will clean the comments of parentAcc.
def wipeComments(body):
for comment in parentAcc.redditor(name=str(parentAcc.user.me())).comments.top(time_filter='all'):
comment.edit(body)


###WARNING###
#This Account will be wiped
###WARNING###
#Parent Account
parentAcc = praw.Reddit(client_id='',
client_secret='',
password='k',
user_agent='AccMigrate by /u/letmelive123',
username='')

#Secondary Account
secAcc = praw.Reddit(client_id='',
client_secret='',
password='',
user_agent='AccMigrate by /u/letmelive123',
username='')

#Body for replacing comments
body="Test"

print("Hello welcome to AccMigrate.")
print("Please note wiping comments does take some time.")

transferMultis()
transferSubs()
wipeComments(body) print("done")


/r/Python
https://redd.it/6j6rpp