问题
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:
- 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!
- 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.
- 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