#this script captures the current posted links from a del.icio.us webpage import urllib import os #creates list of delicious webpages to pull links from webpageList = ["http://del.icio.us/popular/mapping","http://del.icio.us/popular/design", "http://del.icio.us/popular/webdesign", "http://del.icio.us/popular/web2.0", "http://del.icio.us/popular/technology", "http://del.icio.us/popular/geography"] outfile = open('../includes/linkgrabber.php', 'wt') #opens/creates the linkgrabber.php file #function that opens the file, copies it as a list, and strips the links from it def grabLinks(webpage): sock = urllib.urlopen(webpage) htmlSource = sock.readlines() sock.close() i=0 lines = [] links = [] for i in htmlSource: if 'nofollow' in i: j = i.find('') lines.append(i[j:k]) outfile.write('') #loops through the webpageList and executes the grabLinks function using each page for i in webpageList: webpage = i p = i.find('r/') name = i[p+2:] headers = '

',name,'

' outfile.writelines(headers) #writes the name of the tag header to file grabLinks(webpage) outfile.close()