Last active
May 2, 2023 19:36
-
-
Save charlie-collard/6b5eff6670e4b839ffea89ceaed1aa0f to your computer and use it in GitHub Desktop.
Revisions
-
charlie-collard renamed this gist
May 2, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
charlie-collard created this gist
May 2, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ from collections import defaultdict import praw reddit = praw.Reddit(client_id='client_id', client_secret='client_secret', user_agent='user_agent', password='password', username='username') mods_to_subs = defaultdict(list) subreddits = reddit.subreddits.popular(limit=100) for subreddit in subreddits: try: for moderator in subreddit.moderator(): mods_to_subs[moderator.name].append(subreddit.display_name) except Exception as e: print(e) print(f'Failed to get moderators for /r/{subreddit.display_name}') for mod, subs in sorted(mods_to_subs.items(), key=lambda x: -len(x[1])): print(f"{mod} moderates {len(subs)} subreddits: {subs}\n")