OpenPastebin

[ normal view ]

Syntax: python

   #6526 Posted by anonymous 2008-05-11 05:17:13
Formated by GeSHi
  1. import urllib
  2. import re
  3. import string
  4.  
  5. i = 1
  6. b = 10 # pocet stran
  7.  
  8. bloger = ""
  9.  
  10. while b:
  11. try:
  12. response = urllib.urlopen("http://blog.sme.sk/blogeri.asp?st="+str(i))
  13. data = response.read()
  14. except IOError:
  15. pass
  16.  
  17.  
  18. m = re.findall('<div class="bl-list-foto"><a href="http:\/\/(.*).blog.sme.sk" target="_blank">',data)
  19.  
  20. for z in m:
  21. bloger += z + "\n"
  22.  
  23. if i > b: break
  24. i += 1
  25.  
  26. f = file('bloger.txt', 'w')
  27. f.write(bloger)
  28. f.close()
Parsed in 0.01392388 seconds
Email this post Email  ::  Print Print   
:: Download   Download Text File6526.txt   Download Gziped text File6526.txt.gz   Download HTML File6526.html   Download PDF File6526.pdf
:: Print into    Print into HTML FileHTML document   Print into PDF FilePDF document