Guest User

Untitled

a guest
Nov 12th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. #!/usr/bin/python
  2. import urllib, json
  3. from random import choice
  4. import time
  5.  
  6. sources = ["ChildPornography", "narcotics", "suicid"]
  7.  
  8.  
  9. def randomurl(searchfor):
  10.   query = urllib.urlencode({'q': searchfor})
  11.   url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s' % query
  12.   search_response = urllib.urlopen(url)
  13.   search_results = search_response.read()
  14.   results = json.loads(search_results)
  15.   data = results['responseData']
  16.   hits = data['results']
  17.   return choice(hits)['url']
  18.  
  19. def main():
  20.     wordlist = open("words.txt").readlines() #dictionary of random words 1 per line
  21.     for i in range(10):
  22.         print randomurl(choice(wordlist))
  23.         time.sleep(1)
  24.        
  25. main()
Advertisement
Add Comment
Please, Sign In to add comment