Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###################
- ##google img
- ###################
- elif (used_prefix and cmd == "gis") and len(args) > 0:
- args = args.replace(' ','+')
- url = urllib.request.urlopen('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q='+args+'&start=0&safe=off')
- js = json.loads(url.read().decode("utf8"))
- if "responseData" in js:
- results = js['responseData']['results']
- rest = []
- for i in results:
- result = i['unescapedUrl']
- if(len(result)> 10):
- rest.append(result)
- try:
- return room.message("%s" % random.choice(rest))
- except:
- return room.message("Nothing found D:")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement