Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to bulk subscribe to all subreddits in a particular list programmatically (there is no built-in way to do this)

Currently the list is return-separated and " (break)" separated as well, but of course it could be in any other format such as csv. or whatever.

Hoping someone here could help me. I scoured google to try and find a solution but couldn't for the life of me, I must be missing something in my search! I'm surprised that nobody else would like this functionality.

like image 656
wyvernwes Avatar asked Sep 06 '25 15:09

wyvernwes


1 Answers

here is a naive solution with praw, it assumes you have a text file containing the subreddits you wish to subscribe to (separate lines for each subreddit) and a custom application added to your reddit account:

    import praw
    
    reddit = praw.Reddit(
        user_agent="mass sub",

        # visit https://old.reddit.com/prefs/apps/ to add a new script
        # choose http://localhost:8080 as a random and unused callback url 
        # fill in the correct credentials

        client_id="",
        client_secret="",
        username="",
        password=""
    )
    
    file1 = open('./some_txt_file_of_subreddits', 'r')

    Lines = file1.readlines()
    
    for line in Lines:
        print("Line: {}".format(line.strip()))
        reddit.subreddit(line.strip()).subscribe()

if you need to generate a list of subreddits from an existing account you can use this bookmarklet

The bookmarklet script below should be run on https://www.reddit.com/subreddits/mine/

javascript:$('body').replaceWith('<body>'+$('.subscription-box').find('li').find('a.title').map((_, d) => $(d).text()).get().join("<br>")+'</body>');javascript.void()

where the output can be saved to a text file

like image 165
lfender6445 Avatar answered Sep 10 '25 21:09

lfender6445