Skip to content

Instantly share code, notes, and snippets.

@nkhil
Forked from timvisee/SUBREDDIT_LIST.md
Created July 8, 2025 11:11
Show Gist options
  • Select an option

  • Save nkhil/f07502f726f403ea642cf1d26b383ef2 to your computer and use it in GitHub Desktop.

Select an option

Save nkhil/f07502f726f403ea642cf1d26b383ef2 to your computer and use it in GitHub Desktop.

Revisions

  1. @timvisee timvisee revised this gist Mar 2, 2021. No changes.
  2. @timvisee timvisee revised this gist Mar 2, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions SUBREDDIT_LIST.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    As posted on: https://timvisee.com/blog/list-export-your-subreddits/

    # Get a list of your subreddits
    To obtain a list of your subreddits, do the following:

  3. @timvisee timvisee revised this gist Aug 20, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion SUBREDDIT_LIST.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Get a list of your subreddits
    To obtain a list of your subreddits, do the following:

    - First make sure you're logged in on [reddit](https://reddit.com).
    - First make sure you're logged in on [reddit](https://reddit.com), on a desktop browser.
    - Then visit [reddit.com/subreddits](https://reddit.com/subreddits).
    - Then put the following snippet in your browsers address bar, and press `Enter`.
    Make sure `javascript:` is included at the beginning, your browser might remove it while copy-pasting for security reasons:
  4. @timvisee timvisee created this gist Aug 20, 2018.
    34 changes: 34 additions & 0 deletions SUBREDDIT_LIST.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # Get a list of your subreddits
    To obtain a list of your subreddits, do the following:

    - First make sure you're logged in on [reddit](https://reddit.com).
    - Then visit [reddit.com/subreddits](https://reddit.com/subreddits).
    - Then put the following snippet in your browsers address bar, and press `Enter`.
    Make sure `javascript:` is included at the beginning, your browser might remove it while copy-pasting for security reasons:
    ```javascript
    javascript:$('body').replaceWith('<body>'+$('.subscription-box').find('li').find('a.title').map((_, d) => $(d).text()).get().join("<br>")+'</body>');javascript.void()
    ```

    - The reddit page is replaced with a list of all the subreddits you're subscribed to.

    # For nerds
    Here is the expanded snippet:

    ```javascript
    // Build a list of subreddits with break lines between them
    var subs = $('.subscription-box')
    .find('li')
    .find('a.title')
    .map((_, d) => $(d).text())
    .get()
    .join("<br>"));

    // Replace the page with a list of subreddits
    $('body').replaceWith('<body>' + subs +'</body>');

    javascript.void()
    ```

    It finds all items from the subreddit list in the sidebar on the page, and builds an array of subreddit names from it.
    The array is concatinated with breaklines.
    The page is then replaced with this list.