使用 Technorati API -3 基础的 Technorati API 函数
- UID
- 1066743
|
使用 Technorati API -3 基础的 Technorati API 函数
基础的 Technorati API 函数尽管 Technorati API 提供一个强大的搜索函数,但还有一个值得注意的地方,即该 API 还提供其他有用的函数。
cosmos 函数的名字并不直观。它允许您搜索链接到某个基 URL 的博客。例如,假设您想要查找链接回到在 http://nicole-rensmann.bookola.de/blog 中找到的博客文章的所有博客。为此,您应该调用这个 REST 调用:http://api.technorati.com/cosmos?key=xxxx&url=http://nicole-rensmann.bookola.de/blog。如果您将该 URL 复制粘贴到浏览器(可以使用密匙替换 xxxx 字符串),将得到类似于 的结果。
清单 3. cosmos 函数的输出(缩略)
这个 XML 格式的输出与 中的输出极为相似,但也有几个显著的例外。在这里,weblog 元素提供带有入站连接的博客的信息。注意,url 子元素直接对应 url 请求参数。
在这里您又看到几个 item 元素。每个这些元素都包含关于链接回到您查询的博客的博客的信息。
tag 函数允许您搜索带有特定标记的博客文章。Technorati 使用标记对博客文章进行分类。博文作者能够给特定主题的文章放置一个或多个标记。
要在博客圈中查找关于钓鱼的文章,您可以使用这个 URL:http://api.technorati.com/tag?key=xxxx&tag=fishing。在这里同样需要使用您自己的密匙替换 URL 中的 xxxx 字符串。如果您将该 URL 复制粘贴到浏览器中,将看到类似于 的结果。
清单 4. tag 函数的输出(缩略)1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| <?xml version="1.0" encoding="utf-8"?>
<!-- generator="Technorati API version 1.0" -->
<!DOCTYPE tapi PUBLIC "-//Technorati, Inc.//DTD TAPI 0.02//EN"
"http://api.technorati.com/dtd/tapi-002.xml">
<tapi version="1.0">
<document>
<result>
<query>fishing</query>
<postsmatched>43655</postsmatched>
<blogsmatched></blogsmatched>
<start>1</start>
<limit>20</limit>
<querytime>3.126</querytime>
</result>
<item>
<weblog>
<name>Travel and Leisure Articles</name>
<url>http://www.toptravelarticles.com</url>
<rssurl>http://www.toptravelarticles.com/feed</rssurl>
<atomurl>http://www.toptravelarticles.com/feed/atom</atomurl>
<inboundlinks>40</inboundlinks>
<inboundblogs>19</inboundblogs>
<lastupdate>2009-06-21 17:06:01</lastupdate>
<hasphoto></hasphoto>
</weblog>
<title>Visiting Ghana?</title>
<excerpt>If you want to experience the culture up close</excerpt>
<created>2009-06-21 17:06:01</created>
<postupdate>2009-06-21 17:06:01</postupdate>
<permalink>http://www.toptravelarticles.com/visiting-ghana.html</permalink>
</item>
...
|
同样,这个输出类似于其他 Technorati API 函数的输出。基本区别是,在这里博客文章使用 fishing 进行标记。
一个尤其有趣的 Technorati API 函数是 toptags。toptags 函数在执行之后显示最常使用的标记。将这个 URL 复制粘贴到浏览器中(使用您的密匙替换 xxxx):http://api.technorati.com/toptags?key=xxxx。您将看到类似于 的结果。
清单 5. toptags 函数的输出(缩略)1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| <?xml version="1.0" encoding="utf-8"?>
<!-- generator="Technorati API version 1.0 /topptags" -->
<!DOCTYPE tapi PUBLIC "-//Technorati, Inc.//DTD TAPI 0.02//EN"
"http://api.technorati.com/dtd/tapi-002.xml">
<tapi version="1.0">
<document>
<result>
<limit>20</limit>
</result>
<item>
<tag>Weblog</tag>
<posts>9578863</posts>
</item>
<item>
<tag>Life</tag>
<posts>7355121</posts>
</item>
<item>
<tag>News</tag>
<posts>4638644</posts>
</item>
...
|
这个输出很容易解析。不仅列出了每个标记,还在下一个元素中列出了包含该标记的博客文章的数量。 |
|
|
|
|
|