- Code: Select all
import urllib2
import xml.dom.minidom
f = urllib2.urlopen("http://query.yahooapis.com/v1/public/yql?q=select%20title%20from%20rss%20where%20url%3D%22http%3A%2F%2Fwww.npr.org%2Frss%2Frss.php%3Fid%3D1001%22&diagnostics=true")
dom = xml.dom.minidom.parse(f)
f.close()
sayString = ""
for titleElem in dom.getElementsByTagName("title"):
sayString += "%s\n" % titleElem.firstChild.data
# Unclear if you really need it spoken to a file
# so I'll just tell the server to speak the string
indigo.server.speak(sayString)
You'll probably want to run this as an external script so that if the network connection is slow the script won't get killed prematurely.