How to retrieve delicious related tags

2019-08-09 14:26发布

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条回答
对你真心纯属浪费
2楼-- · 2019-08-09 14:38

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.

查看更多
登录 后发表回答