How to retrieve delicious related tags

China☆狼群 提交于 2019-12-11 12:47:52

问题


I have found this example here which uses delicious related tags and create a graph. But I don't know how they implemented it. I don't know how to get a list of related tags from delicious API, because in the documentation it is not mentioned at all, but in delicious website when you search for a tag it shows related tags in the right hand.

Does anybody know how to get related tags using API?

Thank you


回答1:


You might want to refer to Delicious' API page. There is specific section on getting tags.

Not knowing what language you're using (I didn't see any examples in the link you provided; admittedly I didn't dig too deep), I'm presenting some Python which uses the urllib.FancyURLopener:

import urllib
u = urllib.FancyURLopener({})
f = u.open("https://api.del.icio.us/v1/tags/get")
tags = f.readlines()
for tag_line in tags:
    print tag_line

Notes about this code:

  1. The urllib doc page contains this caveat about using the module with https:

    Warning - When opening HTTPS URLs, it does not attempt to validate the server certificate. Use at your own risk!

  2. As coded above, you will be prompted for your Delicious username & password. To work around this, you need to override the prompt_user_password method.
  3. As you may have guessed by the need for authentication, this only gets tags for the user whose credentials you provide. I did not see how to get tags for all of Delicious.


来源:https://stackoverflow.com/questions/8069739/how-to-retrieve-delicious-related-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!