Advertisement
Guest User

Kodzik

a guest
Oct 14th, 2019
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4.  
  5. def search(q):
  6.     q = '+'.join(q.split())
  7.     response = requests.get('https://www.google.com/search?&q='+ q)
  8.     soup = BeautifulSoup(response.text, 'html.parser')
  9.    
  10.     results = soup.find_all('div', attrs={'class': 'r'})
  11.     print(results)
  12.  
  13. search(input('Search: '))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement