Skip to content

Instantly share code, notes, and snippets.

@whutch
Last active July 5, 2016 19:07
Show Gist options
  • Save whutch/418cd6a7d8048b3ec2bcdc13a59133c6 to your computer and use it in GitHub Desktop.
Save whutch/418cd6a7d8048b3ec2bcdc13a59133c6 to your computer and use it in GitHub Desktop.
"""
Install:
sudo pip install praw
git clone https://github.com/PurelyApplied/roll_one_for_me
cd roll_one_for_me
wget https://gist.githubusercontent.com/whutch/418cd6a7d8048b3ec2bcdc13a59133c6/raw/roll.py
Example usage:
python roll.py https://www.reddit.com/r/BehindTheTables/comments/4pxgzh/villains/
"""
import sys
import praw
from roll_one import TableSource
USER_AGENT = "Generate an outcome for random tables, under the name " \
"/u/roll_one_for_me Written and maintained by /u/PurelyApplied"
reddit = praw.Reddit(user_agent=USER_AGENT)
link = sys.argv[1]
submission = reddit.get_submission(link)
table = TableSource(submission, submission.title)
results = table.roll()
print(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment