Last active
August 19, 2017 00:38
-
-
Save 64lines/7ff6834b46e7b08aef19107be172bcca to your computer and use it in GitHub Desktop.
This file contains hidden or 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 feedparser | |
| import os | |
| import random | |
| from talker import say_text | |
| from talker import greeting | |
| def get_entries(url): | |
| return feedparser.parse(url).entries | |
| def format_entry(entry): | |
| print entry["link"] | |
| return "[[slnc 700]] %s" % entry["title"] | |
| def read_news(url): | |
| return [say_text(format_entry(entry)) for entry in get_entries(url)] | |
| def run_reader(): | |
| print "Reading..." | |
| greeting() | |
| [read_news(url) for url in [ | |
| "http://rss.nytimes.com/services/xml/rss/nyt/World.xml", | |
| "http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml", | |
| "http://rss.nytimes.com/services/xml/rss/nyt/Technology.xml", | |
| "http://rss.nytimes.com/services/xml/rss/nyt/Arts.xml", | |
| "http://rss.nytimes.com/services/xml/rss/nyt/Travel.xml", | |
| "http://rss.nytimes.com/services/xml/rss/nyt/Sports.xml", | |
| "http://rss.nytimes.com/services/xml/rss/nyt/Science.xml", | |
| "http://rss.nytimes.com/services/xml/rss/nyt/Health.xml" | |
| ]] | |
| run_reader() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment