mirror of
https://github.com/wassname/RedditAgain.git
synced 2026-06-27 16:43:54 +08:00
Working
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Komodo Project File - DO NOT EDIT -->
|
||||
<project id="949f5a16-9cb0-4ffe-bd5d-ef6dd393f787" kpf_version="5" name="RedditAgain.komodoproject">
|
||||
</project>
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
import praw
|
||||
|
||||
USER_AGENT = 'RedditAgain by @karangoeluw // github: thekarangoel'
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
print '>> Login to OLD account..'
|
||||
|
||||
r = praw.Reddit(USER_AGENT)
|
||||
r.login()
|
||||
|
||||
print '\t>>Login successful..'
|
||||
old_user = r.user # get a praw.objects.Redditor object
|
||||
|
||||
print '>> Deleting all comments...'
|
||||
for com in r.get_comments(limit=None):
|
||||
com.delete()
|
||||
sys.stdout.write('. ')
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
print '>> Deleting all submissions...'
|
||||
for sub in r.get_submitted(limit=None):
|
||||
sub.delete()
|
||||
sys.stdout.write('. ')
|
||||
sys.stdout.flush()
|
||||
|
||||
print '>> Preparing to migrate subscriptions.'
|
||||
|
||||
subs = r.get_my_subreddits(limit=None)
|
||||
|
||||
r2 = praw.Reddit(USER_AGENT)
|
||||
new_username = raw_input('>> Enter username of new account to be registered.')
|
||||
new_pass = raw_input('\t>> Enter preferred password for %s' % new_username)
|
||||
|
||||
r2.create_redditor(new_username, new_pass) # create the new account
|
||||
|
||||
r2.login(new_username, new_pass)
|
||||
|
||||
new_user = r2.user # get a praw.objects.Redditor object
|
||||
print '\t>>Login successful..'
|
||||
|
||||
print '>> Migrating subscriptions...'
|
||||
for sub in subs:
|
||||
r2.get_subreddit(sub.display_name).subscribe()
|
||||
r.get_subreddit(sub.display_name).unsubscribe()
|
||||
sys.stdout.write('. ')
|
||||
sys.stdout.flush()
|
||||
|
||||
print '>> Done migrating. Deleting old user.'
|
||||
Reference in New Issue
Block a user