While I know some Python language I just can seem to make thi work:
So I have this script that when you post a command: -ytb [search terms], it would look up the video in an atom feed from yuotube, could you tell me what I have wroong here? Because when I sseatch up a term with a "space" in it it cannot find the term searched, but when typed with just one word it works. Surprisingly this does not use any youtube modules, but can find videos , I just cant include spaces in the search terms.
elif cmd == "-ytb":
try:
word = args
results = []
data = urlreq.urlopen('http://gdata.youtube.com/feeds/api/videos?max-results=01&vq=' + word)
tree = ET.parse(data)
ns = '{http://www.w3.org/2005/Atom}'
for entry in tree.findall(ns + 'entry'):
for link in entry.findall(ns + 'link'):
if link.get('rel') == 'alternate':
results.append(link.get('href'))
room.message(link.get('href'))
except:
room.message('cant find ' + word + ' sorry')