Nota Sab Jul 10, 2010 8:27 pm

bot irc que dice titulos de youtubes que escriben los users

Aupa!

Bueno, estoy programando un bot en bash que haga lo que dice el titulo del post. El codigo (buggy, I know...) que tengo de momento es el siguiente:

  Código:
#!/bin/bash

NICK=vlan7bot
SERVER=${1:-dune.irc-hispano.org}
CANAL=${2:-#canal}

echo "NICK $NICK" >input
echo "USER $NICK $NICK $NICK :$0" >>input
tail -f input | telnet $SERVER 6667 | \
while true
do read LINE || break
  echo $LINE
  if echo $LINE | grep "PING" &>/dev/null
  then echo "PONG $LINE" >>input
    echo "JOIN $CANAL" >>input #***sacar esto de aqui!!!
    echo "MODE $NICK +c" >>input #***sacar esto de aqui!!!
  fi
  if echo $LINE | grep -i "youtube.com" &>/dev/null
  then
    LINE=$(echo $LINE |grep -o "www.youtube[^ ]*")
    echo "PRIVMSG $CANAL : $(curl ${LINE%&*} 2>&1 |grep -iA2 '<title>' |grep '-' |sed 's/^- //')" >>input
  fi
done


Bien, mi problema es que el bot tarda en darse cuenta de que los usuarios dicen URLs de youtube, y no se bien por que. Eso si, una vez pasa 1 minuto aproximadamente, todo va sobre ruedas (mas o menos jeje).

A ver si algun wadalbertita me arroja algo de luz.

Gracias.

<EDIT>
A base de cambiar cosas, ha quedado solucionado.
Un saludo.
</EDIT>
The attacker isn't attacking the SID, but the fact that the SID exists, and is used for authentication
Alek Amrani, Session donation, Defcon 17
http://www.vlan7.org