Check del.icio.us link


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #
  2. # Get Statistics from Del.icio.us for a given URL
  3. # Author: Abhinay Omkar < abhiomkar AT gmail.com >
  4. #
  5. # GPLed
  6.  
  7. import re,urllib2,sys
  8. url = sys.argv[1]
  9.  
  10. print "Fetching..."
  11.  
  12. try:
  13. # How many did tag the url...
  14. raw = urllib2.urlopen("http://del.icio.us/url/check?url="+url).read()
  15. URL = re.compile(r'<input name="url" size="30" value="(.*)"/>').search(raw).group()[35:-3]
  16. print
  17. print "URL: "+URL,
  18. print "("+re.compile(r'this url has been saved by (.*) people').search(raw).group()+")"
  19.  
  20. # list tags
  21. print "Tags :",
  22. for tag in re.compile(r'<a href="/tag/(.*)" class="').findall(raw):
  23. print tag,
  24.  
  25. except:
  26. print
  27. print "Failed to fetch "+url+". Or no one has tagged it."

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.