Last active
December 12, 2015 06:58
-
-
Save dmarx/4732673 to your computer and use it in GitHub Desktop.
Identifying popular video domains submitted to reddit
This file contains 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 characters
import praw | |
from collections import Counter | |
params = {'limit':None, 'url_data':{'limit':100}} | |
memo = Counter() | |
r = praw.Reddit('investigating popular video domains, /u/shaggorama') | |
subreddits = ['videos', 'trailers','listentothis'] | |
for sub_name in subreddits: | |
subr = r.get_subreddit(sub_name) | |
all_top = subr.get_top_from_all(**params) | |
year_top = subr.get_top_from_year(**params) | |
month_top = subr.get_top_from_month(**params) | |
week_top = subr.get_top_from_week(**params) | |
day_top = subr.get_top_from_day(**params) | |
top = [all_top, year_top, month_top, week_top, day_top] | |
for gen in top: | |
for subm in gen: | |
memo[subm.domain]+=1 | |
memo.most_common() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment