Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

habi

By: a guest on Apr 6th, 2009  |  syntax: Python  |  size: 1.24 KB  |  hits: 325  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/python
  2. # Filename: identica.py
  3. # loads defined notes from identi.ca and saves then to "timeline.txt" for further perusal
  4.  
  5. import urllib
  6. import string
  7.  
  8. for counter in range(1,100,1) :
  9.         url = "http://identi.ca/notice/" + str(counter)
  10.         print "loading " + str(url)
  11.         html = urllib.urlopen(url)
  12.         while 1:
  13.                 htmlline = html.readline()
  14.                 if htmlline == "":
  15.                         break
  16.                 if (htmlline.find("<title>") > -1) :
  17.                         htmlline = htmlline.replace("<title>"," ")
  18.                         htmlline = htmlline.replace("</title>"," ")
  19.                         htmlline = htmlline.replace("UTC - Identi.ca"," ")
  20.                         htmlline = htmlline.replace("'s status on ","")
  21.                         htmlline = htmlline.replace("Monday,",",")
  22.                         htmlline = htmlline.replace("Tuesday,",",")
  23.                         htmlline = htmlline.replace("Wednesday,",",")
  24.                         htmlline = htmlline.replace("Thursday,",",")
  25.                         htmlline = htmlline.replace("Friday,",",")
  26.                         htmlline = htmlline.replace("Saturday,",",")
  27.                         htmlline = htmlline.replace("Sunday,",",")
  28.                         htmlline = htmlline.replace("-08 ","-08, ")
  29.                         htmlline = htmlline.replace("-09 ","-09, ")
  30.                         htmlline = htmlline.strip(" ")
  31.                         print "saving title of " + str(url) + " to timeline.txt"
  32.                         timeline = open('timeline.csv', 'a')
  33.                         timeline.write(str(counter) + ", " + htmlline)
  34. timeline.close()