Skip to content

Instantly share code, notes, and snippets.

@pathcl
Last active August 28, 2015 14:23
Show Gist options
  • Select an option

  • Save pathcl/6a3e3f03a8745f4b63f4 to your computer and use it in GitHub Desktop.

Select an option

Save pathcl/6a3e3f03a8745f4b63f4 to your computer and use it in GitHub Desktop.
googlesearch.py
#!/usr/bin/env python2.7
# You need to have installed google module
# i.e.
# easy_install google
# https://pypi.python.org/pypi/google
try:
import re
import sys
import google
import warnings
warnings.filterwarnings("ignore")
except ImportError:
raise ImportError("Check your python modules")
if len(sys.argv) < 2:
print("Usage: ./googlesearch wordstosearch.txt")
sys.exit(1)
fh = open(sys.argv[1])
for word in fh.readlines():
print("\nSearching for {0}".format(word.strip()))
results = google.search(word.strip(), tld='cl', lang='es')
try:
for link in results:
if re.search("youtube", link) == None:
print(link)
except KeyError:
pass
@pathcl

pathcl commented Aug 28, 2015

Copy link
Copy Markdown
Author

➜ ./googlesearch.py palabras.txt

Searching for restaurantes santiago
http://www.golfodinapoli.cl/
http://www.tiramisu.cl/
http://www.patiobellavista.cl/
http://aquiestacoco.cl/
http://www.fuentemardoqueo.cl/
http://www.lbm.cl/
http://www.tripadvisor.cl/Restaurants-g294305-Santiago_Santiago_Metropolitan_Region.html
http://www.tripadvisor.cl/Restaurant_Review-g294305-d8145833-Reviews-Laminga-Santiago_Santiago_Metropolitan_Region.html
http://www.tripadvisor.cl/Restaurant_Review-g294305-d3192360-Reviews-Bocanariz-Santiago_Santiago_Metropolitan_Region.html
http://www.tripadvisor.cl/Restaurant_Review-g294305-d2311987-Reviews-Jewel_of_India-Santiago_Santiago_Metropolitan_Region.html
http://www.tripadvisor.cl/Restaurant_Review-g294305-d7161213-Reviews-Chipe_Libre_Republica_Independiente_del_Pisco-Santiago_Santiago_Metropolitan_Regi.html
https://www.degusta.cl/
https://www.degusta.cl/restaurantes/santiago.html
https://www.degusta.cl/search
https://www.degusta.cl/restaurante/santiago/le-bistrot_685.html
https://www.degusta.cl/restaurante/santiago/warique_1567.html
http://www.800.cl/?id=1093&c=1,2,3,7146,7246,7247&r=664&p=0&esp=1709&t=Todos+los+Restaurantes+Recomendados+de+Santiago
http://www.viajeros.com/destinos/santiago-de-chile/2-restaurantes/
https://www.zomato.com/es/santiago/providencia-restaurantes
https://santiago.restorando.cl/restaurantes-en-providencia
http://www.minube.com/restaurantes/chile/metropolitana/santiago_de_chile
http://www.santiagourmet.com/
http://restaurantes.emol.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment