Guest
Public paste!

fitoria

By: a guest | Feb 24th, 2008 | Syntax: Python | Size: 0.90 KB | Hits: 164 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. #/usr/bin/python
  2. """Programa para bajar todas las tiras de Bilo y Nano desde tiraecol.net
  3. autor: Adolfo Jurgen Fitoria Escobar <adolfo.fitoria@gmail.com> http://fitoria.blogspot.com
  4. Agradecimientos: Igor Guerrero por aclalar algunas dudas
  5. Bajo los terminos de la licencia GPL v3
  6. Managua, Nicaragua 24/02/2008"""
  7. import feedparser
  8. import re
  9. from urllib import urlopen
  10.  
  11. tiras= feedparser.parse("http://www.tiraecol.net/modules/comic/cache/tiraecol-RSS2.0.xml")
  12. numero_de_tiras= int(re.search('(?<=content_id=)\d+',tiras.entries[0].link).group(0))
  13. print numero_de_tiras
  14. while numero_de_tiras>0:       
  15.         url="http://www.tiraecol.net/modules/comic/cache/images/tiraecol-" + str(numero_de_tiras) + ".png"
  16.         tira=urlopen(url)
  17.         nombre_archivo="TiraEcol-"+str(numero_de_tiras)+".png" 
  18.         f = file(nombre_archivo, "wb+")
  19.         f.write(tira.read())
  20.         numero_de_tiras-=1
  21.         print "Se ha descargado el archivo: " + nombre_archivo