Skip to content

Instantly share code, notes, and snippets.

@etnguyen03
Created July 18, 2018 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etnguyen03/5479de1890c6e1de051d91359db2918c to your computer and use it in GitHub Desktop.
Save etnguyen03/5479de1890c6e1de051d91359db2918c to your computer and use it in GitHub Desktop.
Reddit_Aww u/etnguyen03
# Reddit_Aww u/etnguyen03
# August 18, 2018
# Writes to RedditAww.txt a comma-separated file of subreddit name and subscriber count
# Loops through 1-20 (inclusive) of "w"'s in "aww" for subreddit name
# -1 signifies "Subreddit non existent"
import praw
reddit = praw.Reddit(client_id="REDACTED", client_secret="REDACTED", user_agent="Reddit_AwwBOT")
reddit.read_only = True
outFile = open("RedditAww.txt", "w")
for i in range(1, 21): # so it's 1 "w" to 20 "w"'s
try:
subredditString = "a"
for i in range(0, i):
subredditString += "w"
subreddit = reddit.subreddit(subredditString)
print (subreddit.subscribers)
outFile.write(subredditString+","+str(subreddit.subscribers)+"\n")
except Exception:
outFile.write(subredditString+",-1\n")
print (subredditString + " non existent")
outFile.close()
aw,-1
aww,17552296
awww,52124
awwww,1080
awwwww,226
awwwwww,162
awwwwwww,85
awwwwwwww,57
awwwwwwwww,44
awwwwwwwwww,44
awwwwwwwwwww,49
awwwwwwwwwwww,39
awwwwwwwwwwwww,44
awwwwwwwwwwwwww,56
awwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwww,14
awwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwww,24
awwwwwwwwwwwwwwwwwww,12
awwwwwwwwwwwwwwwwwwww,74
awwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwwwwwwwww,-1
awwwwwwwwwwwwwwwwwwwwwwwwwwwww,-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment