Skip to content

Instantly share code, notes, and snippets.

@juanalonso
Created June 23, 2021 06:37
Show Gist options
  • Save juanalonso/66a0b4a2f44d656ec8386368d5006146 to your computer and use it in GitHub Desktop.
Save juanalonso/66a0b4a2f44d656ec8386368d5006146 to your computer and use it in GitHub Desktop.
Comprueba si las palabras de una lista existen
import urllib.parse
import pycurl
import time
from io import BytesIO
palabras=[
"coalisilarse", "coamurrar", "codicionalizar", "colicionar", "colubilizar",
"comendar", "compadrentarse", "compleyar", "concepturar", "concerter",
]
for index, palabra in enumerate(palabras):
url = f'https://iedra.es/palabras/?q='+urllib.parse.quote(palabra)+'&search_scope=l&search_type=e&search_order=a'
buffer = BytesIO()
crl = pycurl.Curl()
crl.setopt(crl.URL, url)
crl.setopt(crl.WRITEDATA, buffer)
crl.perform()
crl.close()
contents = buffer.getvalue().decode('utf-8')
if contents.find('No hay ') == -1:
print(f'{palabra} EXISTE')
print(url, '\n')
if index % 15 == 0:
print(f'{index}/{len(palabras)}')
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment