- 追加された行はこの色です。
- 削除された行はこの色です。
&tag(Twitter, TwitterAPI, SearchAPI);
*目次 [#xf5e98c6]
#contents
*参考情報 [#j1696e96]
-[[Twitter API Wiki / Twitter Search API Method: search:http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search]]
*パラメータ [#l52f804a]
**q: [#odd6ea86]
-検索語を指定する。
-URLエンコードが必要。
-OR検索したい場合は"+OR+"で結合する。例えば「@twitterapi OR @twitter」だと
http://search.twitter.com/search.atom?q=%40twitterapi+OR+%40twitter
*レスポンス [#k791b5a1]
-JSON形式 OR ATOM形式で取得できる。
-JSON推奨らいいが、ATOM形式じゃないと取得できない情報もあるので困る(nameとか)。
JSON形式のレスポンス
#pre{{
{"results":[
{"text":"@twitterapi http:\/\/tinyurl.com\/ctrefg",
"to_user_id":396524,
"to_user":"TwitterAPI",
"from_user":"jkoum",
"metadata":
{
"result_type":"popular",
"recent_retweets": 109
},
"id":1478555574,
"from_user_id":1833773,
"iso_language_code":"nl",
"source":"<a href="http:\/\/twitter.com\/">twitter<\/a>",
"profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/118412707\/2522215727_a5f07da155_b_normal.jpg",
"created_at":"Wed, 08 Apr 2009 19:22:10 +0000"},
... truncated ...],
"since_id":0,
"max_id":1480307926,
"refresh_url":"?since_id=1480307926&q=%40twitterapi",
"results_per_page":15,
"next_page":"?page=2&max_id=1480307926&q=%40twitterapi",
"completed_in":0.031704,
"page":1,
"query":"%40twitterapi"}
}
}}
ATOM形式のレスポンス
#pre{{
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/">
<id>tag:search.twitter.com,2005:search/twitter</id>
<link type="text/html" href="http://search.twitter.com/search?q=twitter" rel="alternate"/>
<link type="application/atom+xml" href="http://search.twitter.com/search.atom?q=twitter" rel="self"/>
<title>twitter - Twitter Search</title>
<link type="application/opensearchdescription+xml" href="http://search.twitter.com/opensearch.xml" rel="search"/>
<link type="application/atom+xml" href="http://search.twitter.com/search.atom?q=twitter&since_id=22066257016" rel="refresh"/>
<twitter:warning>since_id removed for pagination.</twitter:warning>
<updated>2010-08-25T06:05:00Z</updated>
<openSearch:itemsPerPage>15</openSearch:itemsPerPage>
<link type="application/atom+xml" href="http://search.twitter.com/search.atom?max_id=22066257016&page=2&q=twitter" rel="next"/>
<entry>
<id>tag:search.twitter.com,2005:22066257016</id>
<published>2010-08-25T06:05:00Z</published>
<link type="text/html" href="http://twitter.com/KhayliLuvBieber/statuses/22066257016" rel="alternate"/>
<title>All that I see on my timeline right now is "good nite" & "I'm going to bed". LOL! Twitter is always dead when I get home frm skol!</title>
<content type="html">All that I see on my timeline right now is &quot;good nite&quot; &amp; &quot;I&apos;m going to bed&quot;. LOL! <b>Twitter</b> is always dead when I get home frm skol!</content>
<updated>2010-08-25T06:05:00Z</updated>
<link type="image/png" href="http://a3.twimg.com/profile_images/1108504895/KhayliLuvBieber_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://www.echofon.com/" rel="nofollow">Echofon</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>KhayliLuvBieber (Khayli Bruton)</name>
<uri>http://twitter.com/KhayliLuvBieber</uri>
</author>
</entry>
...
}}
*注意点 [#f71263be]
**レスポンスのfrom_user_idとto_user_idがuser_idではない問題 [#pfec8e0e]
-[[Issue 214 - twitter-api - Search API "from_user_id" doesn't match up with the proper Twitter "user_id" - Project Hosting on Google Code:http://code.google.com/p/twitter-api/issues/detail?id=214]]
-[[Twitterの検索APIのやっかいな問題 - func09:http://www.func09.com/wordpress/archives/876]]
-[[[Mi]みたいなもの » Blog Archive » Twitterのユーザーを特定する方法:http://game5.jp/blog/2010/06/04/twitter%E3%81%AE%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E3%82%92%E7%89%B9%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/]]
-