[Python] Buscador de sueños 0.1

Iniciado por BigBear, Abril 04, 2012, 01:36:03 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Abril 04, 2012, 01:36:03 PM Ultima modificación: Mayo 03, 2014, 09:42:30 AM por Flemon
Un simple buscador de sueños hecho en Python.

Código: python

#!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

Muy bueno Doddy, un saludo!
Twitter: @The_Pr0ph3t
[email protected]