Código
#!usr/bin/python #coding: utf-8 #Buscador de sueños 0.1 #Coded By Doddy H import urllib2,re,sys def toma(web) : nave = urllib2.Request(web) nave.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5'); op = urllib2.build_opener() return op.open(nave).read() def head(): print "\n-- == Buscador de sueños == --\n" def copyright(): print "\n\n(C) Doddy Hackman 2012\n" raw_input() sys.exit(1) head() url = raw_input("\n\n[+] Texto : ") try: code = toma("http://www.mis-suenos.org/interpretaciones/buscar?text="+url) if (re.findall("<li>(.*)<\/li>",code)): re = re.findall("<li>(.*)<\/li>",code) re = re[0] if not re=="": print "\n\n[+] Significado : "+re else: print "[-] No se encontro significado\n" except: print "[-] Error\n" copyright() # The End