Advertisement
numberzero

Untitled

Jan 6th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1.  
  2. ###################
  3. ##google img
  4. ###################
  5. elif (used_prefix and cmd == "gis") and len(args) > 0:
  6. args = args.replace(' ','+')
  7. url = urllib.request.urlopen('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q='+args+'&start=0&safe=off')
  8. js = json.loads(url.read().decode("utf8"))
  9. if "responseData" in js:
  10. results = js['responseData']['results']
  11. rest = []
  12. for i in results:
  13. result = i['unescapedUrl']
  14. if(len(result)> 10):
  15. rest.append(result)
  16. try:
  17. return room.message("%s" % random.choice(rest))
  18. except:
  19. return room.message("Nothing found D:")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement