List & export your subreddits

2 minute read    Published: 2021-03-01

The last few years I've been wanting to export the list of subreddits I joined. It's fun to share with friends having a similar interest, as I've collected many gems throughout the years.

To achieve this I've set-up a simple script. It exports your subreddits to a plain text list.

How to export

  1. Visit old.reddit.com/subreddits/mine in a desktop browser, make sure you're logged in.
  2. On that page, open your browser developer tools (Keybind: Ctrl+Shift+I).
  3. In the developer tools panel, open the Console tab.
  4. Copy-and-paste the following snippet into the console, press Enter to run it:
    $('body').replaceWith('<body>'+$('.subscription-box').find('li').find('a.title').map((_, d) => $(d).text()).get().join("<br>")+'</body>');javascript.void()
    
  5. Your full list of subreddits will appear on the webpage.

Here is mine.


Tap here if you're a nerd.

For nerds

Here is the above snippet, expanded:

// Pluck list of subreddits from page, build plain text list
var subs = $('.subscription-box')
    .find('li')
    .find('a.title')
    .map((_, d) => $(d).text())
    .get()
    .join("<br>");

// Put list of subreddits on page
$('body').replaceWith('<body>' + subs +'</body>');

javascript.void()

Your complete list of subreddits is located in the sidebar on that page. The script plucks your list of reddits from this sidebar and puts it in an array. Then the array is imploded in a string to show on the page. Super simple.