如何检索美味的相关标签 [英] How to retrieve delicious related tags
问题描述
我在此处找到了这个示例,该示例使用了美味的相关标签并创建了图表.但是我不知道他们是如何实现的.我不知道如何从美味的API获取相关标签的列表,因为在文档中根本没有提到它,而是在美味的网站,当您搜索标签时,它会在右侧显示相关标签.
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.
有人知道如何使用API获取相关标签吗?
Does anybody know how to get related tags using API?
谢谢
推荐答案
您可能想参考 Delicious' API页面. 获取标签的特定部分.
不知道您使用的是哪种语言(我没有在您提供的链接中看到任何示例;坦白地说,我并没有做得太深),我正在介绍一些使用
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
有关此代码的注释:
- urllib文档页面包含有关将模块与https:一起使用的警告:>
- The urllib doc page contains this caveat about using the module with https:
警告-打开HTTPS URL时,它不会尝试验证服务器证书.使用后果自负!
如上所述,系统将提示您输入Delicious用户名&密码.要解决此问题,您需要覆盖 prompt_user_password 方法. 您可能对身份验证的需求已经猜到了,这只会为您提供其凭据的用户获取标签.我没有看到如何获取所有Delicious的标签.
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.
这篇关于如何检索美味的相关标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!