Advertisement
Guest User

habi

a guest
Apr 6th, 2009
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement