Skip to content

Instantly share code, notes, and snippets.

@fkaa
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save fkaa/d391eb1f9e852e08f6a7 to your computer and use it in GitHub Desktop.

Select an option

Save fkaa/d391eb1f9e852e08f6a7 to your computer and use it in GitHub Desktop.
import praw
from collections import defaultdict
reddit = praw.Reddit(user_agent='karma_scraper')
reddit.login('username', 'password')
subreddit = reddit.get_subreddit('combatfootage')
response = subreddit.get_top(limit=1000)
results = defaultdict(int)
for val in response:
author = "[deleted]" if val.author is None else val.author.name
results[author] += val.score
for key, value in sorted(results.iteritems(), key=lambda (k,v): (v,k), reverse=True):
print "%s: %s" % (key, value)
1. purpleolive = 9151
2. uptodatepronto = 3913
3. chubachus = 3833
4. BackToPoachingGators = 3477
5. [deleted] = 2981
6. JoshuaJBaker = 2893
7. Dittybopper = 2716
8. cleaningotis = 1917
9. aker04 = 1801
10. immorta1 = 1458
11. VCGS = 1372
12. USCAV19D = 1361
13. firefight13 = 1136
14. USAFHawk = 1136
15. thatfookinschmuck = 1039
16. RebelTactics = 1036
17. Triarius1000 = 957
18. GDK64 = 943
19. SupremeReader = 898
20. Very_Juicy = 870
21. abigpurplemonkey = 858
22. FaceTimE88 = 854
23. tinkthank = 802
24. XiKiilzziX = 792
25. bannedagainbro = 767
26. HoChiMiner = 757
27. MiNDJ = 731
28. Mrprocrastinaut = 717
29. Alexybob = 696
30. Diggtastic = 693
31. jenkem93 = 688
32. Steprichn = 681
33. dshortey = 669
34. jaycrew = 662
35. T-Money2187 = 638
36. silence_hr = 611
37. iaskforbananas = 606
38. tsullivan1175 = 603
39. SpartaWillBurn = 598
40. yogdogz = 592
41. jimbo271 = 592
42. Negro_Napoleon = 591
43. pakrisio = 587
44. PapeRancois = 583
45. IronMaiden571 = 565
46. ThatWun = 559
47. JoshBaker = 559
48. justintime4awesome = 537
49. heyjude321 = 528
50. Discoberry1 = 515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment