[Ruby] Buscador de sueños 0.1

Iniciado por BigBear, Abril 04, 2012, 01:37:44 PM

Tema anterior - Siguiente tema

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

Abril 04, 2012, 01:37:44 PM Ultima modificación: Julio 31, 2014, 10:18:35 PM por Expermicid
Un buscador de sueños en Ruby

Código: ruby

#!usr/bin/ruby
#Buscador de sueños 0.1
#Coded By Doddy H

require "net/http"

def head()
  print "\n\n-- == Buscador de sueños == --\n\n"
end

def copyright()
  print "\n\n(C) Doddy Hackman 2012\n\n"
  gets.chomp
  exit(1)
end

def toma(web)
  return Net::HTTP.get_response(URI.parse(web)).body
end

head()

print "\n[+] Texto : "
string = gets.chomp

url = "http://www.mis-suenos.org/interpretaciones/buscar?text="+string

code = toma(url)

if code=~/<li>(.*)<\/li>/
  text = $1
  if text == " "
    print "\n\n[-] No encontrado"
  else
    print "\n\n[+] Significado : "+text
  end
end

copyright()

#The End ?