Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. from xgoogle.search import GoogleSearch, SearchError
  3.  
  4. try:
  5. gs = GoogleSearch("search query")
  6. gs.results_per_page = 50
  7. results = gs.get_results()
  8.  
  9. for res in results:
  10. print res.title.encode("utf8")
  11. print res.url.encode("utf8")
  12. print
  13. except SearchError, e:
  14. print "Search failed: %s" % e
  15.  
  16. {title1:url1, title50,url50}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement