Skip to content

Instantly share code, notes, and snippets.

@nicksyna01
Created July 22, 2019 20:32
Show Gist options
  • Select an option

  • Save nicksyna01/2c5bea39fcc07e1e254c5f5a8323eeed to your computer and use it in GitHub Desktop.

Select an option

Save nicksyna01/2c5bea39fcc07e1e254c5f5a8323eeed to your computer and use it in GitHub Desktop.
Using Google Search Function Using Python To Search For a Term and Showing the Top Results for it
from googlesearch import search
import urllib.request as ur
from bs4 import BeautifulSoup
try:
from googlesearch import search
except ImportError:
print("No module named 'google' found")
# to search
query = "G20 Summit"
for j in search(query, tld="co.in", num=10, stop=1, pause=2):
print(j)
#html = ur.urlopen(j).read()
#print(html)