Skip to content

Instantly share code, notes, and snippets.

@LyndonArmitage
Created March 9, 2013 18:47
Show Gist options
  • Save LyndonArmitage/5125224 to your computer and use it in GitHub Desktop.
Save LyndonArmitage/5125224 to your computer and use it in GitHub Desktop.
My first Python program. Gets the top 10 news stories from Reddits worldnews subreddit and speaks them out using a Text to Speech engine.
import time
import praw
import pyttsx
__author__ = "Lyndon Armitage"
username = "alarmbot"
password = "password"
engine = pyttsx.init()
r = praw.Reddit(user_agent="Lyndon's News Speaking Bot by /u/LyndonArmitage")
r.login(username, password)
submissions = r.get_subreddit("worldnews").get_hot(limit=10)
titles = []
for sub in submissions:
titles.append(sub.title)
for s in titles:
print s
engine.say(s)
engine.runAndWait()
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment