Guest User

Untitled

a guest
Jun 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #qt is my keyword
  2. values = {'q': qt}
  3. data = urllib.parse.urlencode(values)
  4. url = "http://www.google.fr/search?" + data
  5. req = Request(url, headers={'User-Agent': 'Mozilla/5.0'})
  6. response = urlopen(req).read().lower()
  7. soup = BeautifulSoup(response, "lxml")
  8. resp = soup.get_text()
  9.  
  10. count = sum(1 for _ in re.finditer(r'b%sb' % re.escape(unidecode.unidecode(word)), str(resp)))
Add Comment
Please, Sign In to add comment