he estado utilizando los módulos urllib2 y re de python. y aquí dejo un script que imprime por pantalla cuando hay un nuevo post en el foro (nuevo post, no nueva respuesta) imprime el título y el link.
#monitoreando nuevos post en underc0de.org
#by blozzter.
import re, urllib2
from time import sleep
def monitorear_posts():
contenido = urllib2.urlopen("http://www.underc0de.org/foro/index.php?action=recent").read()
ultimo_registrado = re.findall("rel=\"nofollow\">(.*)</a></h5>\n", contenido)[0] #cogemos el ultimo post
while True:
sleep(60) #luego de un minuto
contenido = urllib2.urlopen("http://www.underc0de.org/foro/index.php?action=recent").read()
ultimo_post = re.findall("rel=\"nofollow\">(.*)</a></h5>\n", contenido)[0]#lo cogemos de nuevo
ultimo_link = re.findall("\s<a href=\"(.*)\"\srel=\"nofollow\">", contenido)[0]
if ultimo_post != ultimo_registrado and ultimo_post[:3] != "RE:": #si son distintos, mostramos el post y el link
print "\t nuevo post en Underc0de!"
print "%s >> %s" % (ultimo_post, ultimo_link)
ultimo_registrado = ultimo_post
monitorear_posts()
seria linda una bot con esta función ::)
saludos.
edito: al momento de estar posteando esto dejé corriendo el script y tomé una captura. eso si falta limpiar un poco la url para que no la tire con tanta basura:
(http://s2.subirimagenes.com/imagen/previo/thump_6859606captura.png)
Nice, yo hice uno para otro foro que mostraba los ultimos 5 post's
Te recomiendo eso si hacer un try / except al tomar la url
ya que como es un bucle infinito (while True) en un momento
dará error
You are not allowed to view links.
You are not allowed to view links.
Register or Login or You are not allowed to view links.
Register or Login
Nice, yo hice uno para otro foro que mostraba los ultimos 5 post's
Te recomiendo eso si hacer un try / except al tomar la url
ya que como es un bucle infinito (while True) en un momento
dará error
acabo de hacer uno que muestra los ultimos 5 post, lo tengo implementado en una bot.
gracias por la recomendación.
saludos.