Twitter関連Twitter REST API:タイムライン関連
- statuses/public_timeline〔つぶやきを公開しているユーザーの最新のつぶやきを取得(認証不要)〕
- statuses/home_timeline〔認証ユーザーとその友達のリツイートを含む最新のつぶやきを取得(要認証)〕
- statuses/friends_timeline〔認証ユーザーとその友達の最新のつぶやきを取得(要認証)※非推奨〕
- statuses/user_timeline〔指定したユーザーのタイムラインを取得(つぶやき非公開ユーザーの場合は要認証)〕
- statuses/mentions〔認証ユーザーの@ユーザー名の返信リストを取得(要認証)〕
- statuses/retweeted_by_me〔認証ユーザーが投稿したReTweet(引用返信)最新20件取得(要認証)〕
- statuses/retweeted_to_me〔フォローしている人が投稿したReTweet(引用返信)最新20件取得(要認証)〕
- statuses/retweets_of_me〔認証ユーザーに対するReTweet(引用返信)最新20件取得(要認証)〕
statuses/public_timeline
つぶやきを公開しているユーザーの最新のつぶやきを取得(認証不要)
2009/7/18
http://api.twitter.com/1/statuses/public_timeline.[xml|json|rss|atom]
パブリックタイムラインは、全世界のツイートから、ツイートを公開しているユーザーの公式RT含む最新のツイートを20件取得します。 ツイートを非公開にしているプロテクトユーザーのツイートは含まれません。 このタイムラインは60秒間キャッシュされます。
パラメーター
パラメーター | 説明 | |
---|---|---|
trim_user | 任意 | ユーザー情報を詳細でなく、ユーザーIDだけにしたい場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/public_timeline.xml?trim_user=1 |
include_entities | 任意 | ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/public_timeline.xml?include_entities=1 |
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:15:41 +0000 2011</created_at> <id>67487891118489600</id> <text>猫が出てきたw http://ow.ly/4Q2u7</text> <source><a href="http://www.tweetdeck.com/">TweetDeck</a></source> <truncated>false</truncated> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <favorited>false</favorited> <in_reply_to_screen_name></in_reply_to_screen_name> <user> <id>7948862</id> <name>つんつ</name> <screen_name>cocoism</screen_name> <location>カワタマ or オモサン</location> <description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description> <profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url> <url>http://phpjavascriptroom.com/</url> <protected>false</protected> <followers_count>594</followers_count> <profile_background_color>8B542B</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>9D582E</profile_link_color> <profile_sidebar_fill_color>EADEAA</profile_sidebar_fill_color> <profile_sidebar_border_color>D9B17E</profile_sidebar_border_color> <friends_count>512</friends_count> <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at> <favourites_count>1</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a2.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <statuses_count>3280</statuses_count> <notifications>false</notifications> <verified>false</verified> <following>false</following> </user> </status> </statuses>
json[0]['text']=猫が出てきたw http://ow.ly/4Q2u7 json[0]['coordinates']= json[0]['truncated']= json[0]['id_str']=67487891118489600 json[0]['source']=HootSuite json[0]['geo']= json[0]['favorited']= json[0]['retweet_count']=0 json[0]['in_reply_to_screen_name']= json[0]['in_reply_to_status_id']= json[0]['in_reply_to_status_id_str']= json[0]['place']= json[0]['created_at']=Mon May 09 07:15:41 +0000 2011 json[0]['contributors']= json[0]['user']['contributors_enabled']= json[0]['user']['profile_use_background_image']= json[0]['user']['following']= json[0]['user']['profile_background_color']=e3cff7 json[0]['user'][description]=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[0]['user']['screen_name']=DaniiaGarcia json[0]['user']['profile_background_image_url']=http://a2.twimg.com/profile_background_images/187449144/02.png json[0]['user']['default_profile_image']= json[0]['user']['verified']= json[0]['user']['id_str']=7948862 json[0]['user']['friends_count']=512 json[0]['user']['profile_text_color']=010205 json[0]['user']['location']=カワタマ or オモサン json[0]['user']['profile_sidebar_fill_color']=b07ceb json[0]['user']['follow_request_sent']= json[0]['user']['profile_background_tile']=1 json[0]['user']['url']=http://phpjavascriptroom.com/ json[0]['user']['default_profile']= json[0]['user']['show_all_inline_media']= json[0]['user']['lang']=es json[0]['user']['geo_enabled']= json[0]['user']['followers_count']=122 json[0]['user']['protected']= json[0]['user']['notifications']= json[0]['user']['time_zone']=Tokyo json[0]['user']['created_at']=Sat Aug 04 05:52:33 +0000 2007 json[0]['user']['profile_link_color']=ff0000 json[0]['user']['name']=つんつ json[0]['user']['is_translator']= json[0]['user']['profile_sidebar_border_color']=8c4ec2 json[0]['user']['id']=7948862 json[0]['user']['listed_count']=52 json[0]['user']['statuses_count']=2652 json[0]['user']['utc_offset']=-32400 json[0]['user']['favourites_count']=430 json[0]['user']['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[0]['retweeted']= json[0]['id']=6.74878911185E+16 json[0]['in_reply_to_user_id_str']= json[0]['in_reply_to_user_id']=
▼http://api.twitter.com/1/statuses/public_timeline.xml <?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:15:41 +0000 2011</created_at> <id>67487891118489600</id> <text>猫が出てきたw http://ow.ly/4Q2u7</text> <source><a href="http://www.tweetdeck.com/">TweetDeck</a></source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>7948862</id> <name>つんつ</name> <screen_name>cocoism</screen_name> <location>カワタマ or オモサン</location> <description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description> <profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url> <url>http://phpjavascriptroom.com/</url> <protected>false</protected> <followers_count>594</followers_count> <profile_background_color>8B542B</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>9D582E</profile_link_color> <profile_sidebar_fill_color>EADEAA</profile_sidebar_fill_color> <profile_sidebar_border_color>D9B17E</profile_sidebar_border_color> <friends_count>512</friends_count> <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at> <favourites_count>1</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a2.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications></notifications> <geo_enabled>false</geo_enabled> <verified>false</verified> <following></following> <statuses_count>3280</statuses_count> <lang>es</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent></follow_request_sent> <listed_count>1</listed_count> <show_all_inline_media>true</show_all_inline_media> <default_profile>false</default_profile> <default_profile_image>false</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </status> ・・・略・・・ </statuses> ▼http://api.twitter.com/1/statuses/public_timeline.xml?trim_user=1 <?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:15:41 +0000 2011</created_at> <id>67487891118489600</id> <text>猫が出てきたw http://ow.ly/4Q2u7</text> <source><a href="http://www.tweetdeck.com/">TweetDeck</a></source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>7948862</id> </user> <geo/> <coordinates/> <place/> <contributors/> </status> ・・・略・・・ </statuses>
▼http://api.twitter.com/1/statuses/public_timeline.xml?include_entities=1
<status>
<created_at>Mon May 09 07:15:41 +0000 2011</created_at>
<id>67487891118489600</id>
<text>猫が出てきたw http://ow.ly/4Q2u7</text>
<source><a href="http://www.tweetdeck.com/">TweetDeck</a></source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count>0</retweet_count>
<retweeted>false</retweeted>
<user>
<id>7948862</id>
<name>つんつ</name>
<screen_name>cocoism</screen_name>
<location>カワタマ or オモサン</location>
<description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description>
<profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url>
<url>http://phpjavascriptroom.com/</url>
<protected>false</protected>
<followers_count>594</followers_count>
<profile_background_color>8B542B</profile_background_color>
<profile_text_color>333333</profile_text_color>
<profile_link_color>9D582E</profile_link_color>
<profile_sidebar_fill_color>EADEAA</profile_sidebar_fill_color>
<profile_sidebar_border_color>D9B17E</profile_sidebar_border_color>
<friends_count>512</friends_count>
<created_at>Sat Aug 04 05:52:33 +0000 2007</created_at>
<favourites_count>1</favourites_count>
<utc_offset>32400</utc_offset>
<time_zone>Tokyo</time_zone>
<profile_background_image_url>http://a2.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>false</notifications>
<geo_enabled>false</geo_enabled>
<verified>false</verified>
<following>false</following>
<statuses_count>3280</statuses_count>
<lang>en</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent></follow_request_sent>
<listed_count>0</listed_count>
<show_all_inline_media>false</show_all_inline_media>
<default_profile>true</default_profile>
<default_profile_image>false</default_profile_image>
<is_translator>false</is_translator>
</user>
<geo/>
<coordinates/>
<place/>
<contributors/>
<entities>
<user_mentions>
<user_mention end="81" start="73">
<id>55984769</id>
<screen_name>pjroomer</screen_name>
<name>PJR</name>
</user_mention>
</user_mentions>
<urls/>
<hashtags/>
</entities>
</status>
設置サンプル
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>Twitter REST API:タイムライン関連:public_timeline(最新のつぶやきを取得) | 設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="/content/lib/jquery/jquery.jsonp.js"></script> <!-- JS --> <script type="text/javascript"> $(function(){ //公式RT含む var url="http://api.twitter.com/1/statuses/public_timeline.json?page=1&callback={callback}"; $.getJSONP(url, function(json){ var s=""; for(var i in json){ s+="<li>"; if(json[i].retweeted_status){ s+="<a href='http://twitter.com!/"+json[i].retweeted_status.user.screen_name+"' class='prof'><img src='"+json[i].retweeted_status.user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p class='footer'><a href='https://twitter.com!/"+json[i].retweeted_status.user.screen_name+"/status/"+json[i].retweeted_status.id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].retweeted_status.source+"から</p>"; s+="<p class='rt'>"+json[i].user.screen_name+"がリツイート</p>"; s+="</div>"; }else{ s+="<a href='http://twitter.com!/"+json[i].user.screen_name+"' class='prof'><img src='"+json[i].user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p><a href='https://twitter.com!/"+json[i].user.screen_name+"/status/"+json[i].id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].source+"から</p>"; s+="</div>"; } s+="</li>"; } $("#recent").html("<ul>"+s+"</ul>"); }); }); // リンク内につぶやきを含むURLに変更 function formatTwitterString(str){ str = str.replace(/((ftp|http|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>'); str = str.replace(/@(\w+)/gm,'<a href="http://twitter.com/$1" target="_blank">@$1</a>'); str = str.replace((\w+)/gm,'<a href="http://search.twitter.com/search?q=$1" target="_blank">#$1</a>'); return str; } function relativeTime(pastTime){ var origStamp = Date.parse(pastTime); var curDate = new Date(); var currentStamp = curDate.getTime(); var difference = parseInt((currentStamp - origStamp)/1000); if(difference < 0) return false; if(difference <= 5) return "いまさっき"; if(difference <= 20) return "数秒前"; if(difference <= 60) return "1分以内"; if(difference < 3600) return parseInt(difference/60)+" 分前"; if(difference <= 1.5*3600) return "1時間前"; if(difference < 23.5*3600) return Math.round(difference/3600)+" 時間前"; if(difference < 1.5*24*3600) return "1日前"; var dateArr = pastTime.split(' '); return (parseInt(difference / 86400)).toString() + '日前'; } </script> <style type="text/css"> #recent div { font-size:80%; } #recent ul { list-style:none; border-top:1px dotted #ccc; margin:0; padding:0; } #recent li { border-bottom:1px dotted #ccc; list-style:none; clear:both; overflow:hidden; margin:0; padding:5px 0; } #recent a.prof { float:left; width:48px; height:48px; overflow:hidden; margin:0; padding:3px 0; } #recent p { margin:0; padding:0; } #recent div { margin:0 0 0 58px; padding:0; } #recent p.footer, #recent p.rt { color:#666; margin-top:5px; } #recent p.rt { background:transparent url(/content/img/topic/twitter/rt.gif) no-repeat 0 0; overflow:hidden; padding-left:16px; min-height:15px; height:auto!important; height:15px; } </style> </head> <body> <div id="wrap"> <h1>Twitter REST API:タイムライン関連:public_timeline(最新のつぶやきを取得) | 設置サンプル</h1> <p>このAPIは認証不要です。つぶやきが公開されておりなおかつアイコンが設定されているユーザーの最新のつぶやきを最大20件取得して表示します。このタイムラインは60秒間キャッシュされます。</p> <!-- CODE --> <div id="recent"></div> <!-- / CODE --> </div> </body> </html>
statuses/home_timeline
認証ユーザーとその友達のリツイートを含む最新のつぶやきを取得(要認証)
2009/7/18
http://api.twitter.com/1/statuses/home_timeline.[xml|json|rss|atom]
ホームタイムラインは、認証ユーザーとフレンド(認証ユーザーがフォローしている人)が投稿した最新のツイートを公式RT含めを20件取得します。 取得結果は、、Twitter公式サイトにログインした後に表示される「ホーム」と同じ内容になります。 最大で、過去800件分のツイート(公式RT含む)を取得することができます。
※ホームタイムラインは、公式RTが含まれることを除いてフレンドタイムラインと同じです。
パラメーター
パラメーター | 説明 | |
---|---|---|
since_id | 任意 |
指定したステータスIDより後の最新のツイートを取得したい場合に使用。指定したステータスIDは含まれません。 例)http://api.twitter.com/1/statuses/home_timeline.xml?since_id=2567482373 |
max_id | 任意 |
指定したステータスIDより過去のツイートを取得したい場合に使用。指定したステータスIDは含まれます。 例)http://api.twitter.com/1/statuses/home_timeline.xml?max_id=2567482373 |
count | 任意 |
結果として受け取る件数を指定します。 例)http://api.twitter.com/1/statuses/home_timeline.xml?count=10 |
page | 任意 |
指定したページ番号(1ページ20件)のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/home_timeline.rss?page=3 |
trim_user | 任意 |
ユーザー情報を詳細でなく、ユーザーIDだけにしたい場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/home_timeline.xml?trim_user=1 |
include_entities | 任意 |
ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/home_timeline.xml?include_entities=1 |
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:15:41 +0000 2011</created_at> <id>67487891118489600</id> <text>猫が出てきたw http://ow.ly/4Q2u7</text> <source><a href="http://www.hootsuite.com" rel="nofollow">HootSuite</a></source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>7948862</id> <name>つんつ</name> <screen_name>cocoism</screen_name> <location>カワタマ or オモサン</location> <description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description> <profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url> <url>http://phpjavascriptroom.com/</url> <protected>false</protected> <followers_count>594</followers_count> <profile_background_color>8350a1</profile_background_color> <profile_text_color>f2afcf</profile_text_color> <profile_link_color>f2afcf</profile_link_color> <profile_sidebar_fill_color>8350a1</profile_sidebar_fill_color> <profile_sidebar_border_color>8350a1</profile_sidebar_border_color> <friends_count>512</friends_count> <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at> <favourites_count>430</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a2.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url> <profile_background_tile>true</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>true</following> <statuses_count>4803</statuses_count> <lang>ja</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>52</listed_count> <show_all_inline_media>true</show_all_inline_media> <default_profile>false</default_profile> <default_profile_image>false</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </status> </statuses>
json[0]['text']=猫が出てきたw http://ow.ly/4Q2u7 json[0]['coordinates']= json[0]['truncated']= json[0]['id_str']=67487891118489600 json[0]['source']=HootSuite json[0]['geo']= json[0]['favorited']= json[0]['retweet_count']=0 json[0]['in_reply_to_screen_name']= json[0]['in_reply_to_status_id']= json[0]['in_reply_to_status_id_str']= json[0]['place']= json[0]['created_at']=Mon May 09 07:15:41 +0000 2011 json[0]['contributors']= json[0]['user']['profile_use_background_image']=1 json[0]['user']['following']= json[0]['user']['profile_background_color']=8350a1 json[0]['user']['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[0]['user']['screen_name']=cocoism json[0]['user']['contributors_enabled']= json[0]['user']['profile_background_image_url']=http://a2.twimg.com/profile_background_images/187449144/02.png json[0]['user']['default_profile_image']= json[0]['user']['verified']= json[0]['user']['id_str']=7948862 json[0]['user']['show_all_inline_media']=1 json[0]['user']['geo_enabled']=1 json[0]['user']['friends_count']=512 json[0]['user']['profile_text_color']=f2afcf json[0]['user']['location']=カワタマ or オモサン json[0]['user']['profile_sidebar_fill_color']=8350a1 json[0]['user']['follow_request_sent']= json[0]['user']['profile_background_tile']=1 json[0]['user']['url']=http://phpjavascriptroom.com/ json[0]['user']['lang']=ja json[0]['user']['statuses_count']=4803 json[0]['user']['followers_count']=594 json[0]['user']['protected']= json[0]['user']['notifications']= json[0]['user']['time_zone']=Tokyo json[0]['user']['created_at']=Sat Aug 04 05:52:33 +0000 2007 json[0]['user']['profile_link_color']=f2afcf json[0]['user']['name']=つんつ json[0]['user']['is_translator']= json[0]['user']['default_profile']= json[0]['user']['profile_sidebar_border_color']=8350a1 json[0]['user']['id']=7948862 json[0]['user']['listed_count']=52 json[0]['user']['utc_offset']=32400 json[0]['user']['favourites_count']=430 json[0]['user']['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[0]['retweeted']= json[0]['id']=6.74878911185E+16 json[0]['in_reply_to_user_id_str']= json[0]['in_reply_to_user_id']=
statuses/friends_timeline
認証ユーザーとその友達の最新のつぶやきを取得(要認証)※非推奨
2009/7/18
※非推奨
http://api.twitter.com/1/statuses/friends_timeline.[xml|json|rss|atom]
フレンドタイムラインは、認証ユーザーとフレンド(認証ユーザーがフォローしている人)が投稿した最新ツイートを20件取得します。 取得結果は、Twitter公式サイトにログインした後に表示される「ホーム」と同じ内容になります。
※フレンドタイムラインは、公式RTが含まれないことを除いてホームタイムラインと同じです。
パラメーター
パラメーター | 説明 | |
---|---|---|
since_id | 任意 |
指定したステータスIDより後の最新のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/friends_timeline.xml?since_id=2567482373 |
max_id | 任意 |
指定したステータスIDより過去のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/friends_timeline.xml?max_id=2567482373 |
count | 任意 |
結果として受け取る件数を指定します。 例)http://api.twitter.com/1/statuses/friends_timeline.xml?count=10 |
page | 任意 |
指定したページ番号(1ページ20件)のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/friends_timeline.rss?page=3 |
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:15:41 +0000 2011</created_at> <id>67487891118489600</id> <text>猫が出てきたw http://ow.ly/4Q2u7</text> <source><a href="http://www.hootsuite.com" rel="nofollow">HootSuite</a></source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>7948862</id> <name>つんつ</name> <screen_name>cocoism</screen_name> <location>カワタマ or オモサン</location> <description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description> <profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url> <url>http://phpjavascriptroom.com/</url> <protected>false</protected> <followers_count>594</followers_count> <profile_background_color>8350a1</profile_background_color> <profile_text_color>f2afcf</profile_text_color> <profile_link_color>f2afcf</profile_link_color> <profile_sidebar_fill_color>8350a1</profile_sidebar_fill_color> <profile_sidebar_border_color>8350a1</profile_sidebar_border_color> <friends_count>512</friends_count> <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at> <favourites_count>430</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a2.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url> <profile_background_tile>true</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>true</following> <statuses_count>4803</statuses_count> <lang>ja</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>52</listed_count> <show_all_inline_media>true</show_all_inline_media> <default_profile>false</default_profile> <default_profile_image>false</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </status> </statuses>
json[0']['text']=猫が出てきたw http://ow.ly/4Q2u7 json[0']['coordinates']= json[0']['truncated']= json[0']['id_str']=67487891118489600 json[0']['source']=HootSuite json[0']['geo']= json[0']['favorited']= json[0']['retweet_count']=0 json[0']['in_reply_to_screen_name']= json[0']['in_reply_to_status_id']= json[0']['in_reply_to_status_id_str']= json[0']['place']= json[0']['created_at']=Mon May 09 07:15:41 +0000 2011 json[0']['contributors']= json[0']['user']['profile_use_background_image']=1 json[0']['user']['following']= json[0']['user']['profile_background_color']=8350a1 json[0']['user']['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[0']['user']['screen_name']=cocoism json[0']['user']['contributors_enabled']= json[0']['user']['profile_background_image_url']=http://a2.twimg.com/profile_background_images/187449144/02.png json[0']['user']['default_profile_image']= json[0']['user']['verified']= json[0']['user']['id_str']=7948862 json[0']['user']['show_all_inline_media']=1 json[0']['user']['geo_enabled']=1 json[0']['user']['friends_count']=512 json[0']['user']['profile_text_color']=f2afcf json[0']['user']['location']=カワタマ or オモサン json[0']['user']['profile_sidebar_fill_color']=8350a1 json[0']['user']['follow_request_sent']= json[0']['user']['profile_background_tile']=1 json[0']['user']['url']=http://phpjavascriptroom.com/ json[0']['user']['lang']=ja json[0']['user']['statuses_count']=4803 json[0']['user']['followers_count']=594 json[0']['user']['protected']= json[0']['user']['notifications']= json[0']['user']['time_zone']=Tokyo json[0']['user']['created_at']=Sat Aug 04 05:52:33 +0000 2007 json[0']['user']['profile_link_color']=f2afcf json[0']['user']['name']=つんつ json[0']['user']['is_translator']= json[0']['user']['default_profile']= json[0']['user']['profile_sidebar_border_color']=8350a1 json[0']['user']['id']=7948862 json[0']['user']['listed_count']=52 json[0']['user']['utc_offset']=32400 json[0']['user']['favourites_count']=430 json[0']['user']['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[0']['retweeted']= json[0']['id']=6.74878911185E+16 json[0']['in_reply_to_user_id_str']= json[0']['in_reply_to_user_id']=
statuses/user_timeline
指定したユーザーのタイムラインを取得(つぶやき非公開ユーザーの場合は要認証)
2009/7/18
http://api.twitter.com/1/statuses/user_timeline.[xml|json|rss|atom]?user_id=[user-id] http://api.twitter.com/1/statuses/user_timeline.[xml|json|rss|atom]?screen_name=[screen-name]
ユーザータイムラインは、認証ユーザーが投稿したツイートを20件取得します。 他ユーザーのユーザータイムラインを取得する場合は、パラメータ「user_id」または「screen_name」にそのユーザーのユーザーIDまたはスクリーンネームを指定します。
※相互フォローしていてもたユーザーがプロテクトユーザーの場合、そのユーザータイムラインは取得できません。
パラメーター
パラメーター | 説明 | |
---|---|---|
user_id | 任意 | ユーザーIDを指定。有効なユーザーIDを明確に指定したい場合に使用。 例)http://api.twitter.com/1/statuses/user_timeline.xml?user_id=12345 |
screen_name | 任意 | スクリーンネームを指定。ユーザーIDとスクリーンネームが数値で紛らわしい場合に有用。 例)http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=54321 |
since_id | 任意 | 指定したステータスIDより後の最新のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/user_timeline.xml?since_id=2567482373 |
max_id | 任意 | 指定したステータスIDより過去のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/user_timeline.xml?max_id=2567482373 |
count | 任意 | 取得件数を指定。 例)http://api.twitter.com/1/statuses/user_timeline.xml?count=10 |
page | 任意 | 指定したページ番号(1ページ20件)のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/user_timeline.rss?page=3 |
trim_user | 任意 | ユーザー情報を詳細でなく、ユーザーIDだけにしたい場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/user_timeline.xml?trim_user=1 |
include_rts | 任意 | リツイートを含めたユーザータイムラインを取得する場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/user_timeline.xml?include_rts=1 |
include_entities | 任意 | ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/user_timeline.xml?include_entities=1 |
ステータスID(ステータスIDのこと)は、Twitter公式サイトの場合、投稿時間をクリックすると分かります。
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?>
<statuses type="array">
<status> ★公式RT以外のツイート
<created_at>Tue May 10 02:54:12 +0000 2011</created_at>
<id>67784472501813248</id>
<text>扇風機とかスダレとか、昭和生活にカムバックだね。今夏は。</text>
<source><a href="http://www.hootsuite.com" rel="nofollow">HootSuite</a></source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count>0</retweet_count>
<retweeted>false</retweeted>
<user>
<id>7948862</id>
</user>
<geo/>
<coordinates/>
<place/>
<contributors/>
</status>
・・・略・・・
<status> ★公式RTのツイート
<created_at>Tue May 10 05:13:27 +0000 2011</created_at>
<id>67819517241331712</id>
<text>RT @applabjp: Googleがクラウド型の音楽サービスを近々提供開始するのではという情報がネットで飛び交っています。当初は米国内のみでの提供になると思われますが、これはちょっと気になりますね。</text>
<source><a href="http://www.hootsuite.com" rel="nofollow">HootSuite</a></source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count>0</retweet_count>
<retweeted>false</retweeted>
<retweeted_status>
<created_at>Tue May 10 05:02:30 +0000 2011</created_at>
<id>67816763202617344</id>
<text>Googleがクラウド型の音楽サービスを近々提供開始するのではという情報がネットで飛び交っています。当初は米国内のみでの提供になると思われますが、これはちょっと気になりますね。</text>
<source>web</source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count>0</retweet_count>
<retweeted>false</retweeted>
<user>
<id>161940005</id>
</user>
<geo/>
<coordinates/>
<place/>
<contributors/>
</retweeted_status>
<user>
<id>7948862</id>
</user>
<geo/>
<coordinates/>
<place/>
<contributors/>
</status>
・・・略・・・
</statuses>
json[0][text]=猫が出てきたw http://ow.ly/4Q2u7 json[0][coordinates]= json[0][truncated]= json[0][id_str]=67487891118489600 json[0][source]=HootSuite json[0][geo]= json[0][favorited]= json[0][retweet_count]=0 json[0][in_reply_to_screen_name]= json[0][in_reply_to_status_id]= json[0][in_reply_to_status_id_str]= json[0][place]= json[0][created_at]=Mon May 09 07:15:41 +0000 2011 json[0][contributors]= json[0][user][profile_use_background_image]=1 json[0][user][following]= json[0][user][profile_background_color]=8350a1 json[0][user][description]=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[0][user][screen_name]=cocoism json[0][user][contributors_enabled]= json[0][user][profile_background_image_url]=http://a2.twimg.com/profile_background_images/187449144/02.png json[0][user][default_profile_image]= json[0][user][verified]= json[0][user][id_str]=7948862 json[0][user][show_all_inline_media]=1 json[0][user][geo_enabled]=1 json[0][user][friends_count]=512 json[0][user][profile_text_color]=f2afcf json[0][user][location]=カワタマ or オモサン json[0][user][profile_sidebar_fill_color]=8350a1 json[0][user][follow_request_sent]= json[0][user][profile_background_tile]=1 json[0][user][url]=http://phpjavascriptroom.com/ json[0][user][lang]=ja json[0][user][statuses_count]=4803 json[0][user][followers_count]=594 json[0][user][protected]= json[0][user][notifications]= json[0][user][time_zone]=Tokyo json[0][user][created_at]=Sat Aug 04 05:52:33 +0000 2007 json[0][user][profile_link_color]=f2afcf json[0][user][name]=つんつ json[0][user][is_translator]= json[0][user][default_profile]= json[0][user][profile_sidebar_border_color]=8350a1 json[0][user][id]=7948862 json[0][user][listed_count]=52 json[0][user][utc_offset]=32400 json[0][user][favourites_count]=430 json[0][user][profile_image_url]=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[0][retweeted]= json[0][id]=6.74878911185E+16 json[0][in_reply_to_user_id_str]= json[0][in_reply_to_user_id]=
設置サンプル
■ user_id + page
例)@cocoism(ユーザーID=7948862)の最新のツイートを20件(1ページ分)取得(公式RT含まず)
http://api.twitter.com/1/statuses/user_timeline.json?user_id=7948862&page=1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="/content/lib/jquery/jquery.jsonp.js"></script> <!-- JS --> <script type="text/javascript"> $(function(){ var url="http://api.twitter.com/1/statuses/user_timeline.json?user_id=7948862&page=1&callback={callback}"; $.getJSONP(url, function(json){ var s=""; for(var i in json){ s+="<li>"; s+="<a href='http://twitter.com!/"+json[i].user.screen_name+"' class='prof'><img src='"+json[i].user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p><a href='https://twitter.com!/"+json[i].user.screen_name+"/status/"+json[i].id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].source+"から</p>"; s+="</div>"; s+="</li>"; } $("#recent").html("<ul>"+s+"</ul>"); }); }); // リンク内につぶやきを含むURLに変更 function formatTwitterString(str){ str = str.replace(/((ftp|http|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>'); str = str.replace(/@(\w+)/gm,'<a href="http://twitter.com/$1" target="_blank">@$1</a>'); str = str.replace((\w+)/gm,'<a href="http://search.twitter.com/search?q=$1" target="_blank">#$1</a>'); return str; } function relativeTime(pastTime){ var origStamp = Date.parse(pastTime); var curDate = new Date(); var currentStamp = curDate.getTime(); var difference = parseInt((currentStamp - origStamp)/1000); if(difference < 0) return false; if(difference <= 5) return "いまさっき"; if(difference <= 20) return "数秒前"; if(difference <= 60) return "1分以内"; if(difference < 3600) return parseInt(difference/60)+" 分前"; if(difference <= 1.5*3600) return "1時間前"; if(difference < 23.5*3600) return Math.round(difference/3600)+" 時間前"; if(difference < 1.5*24*3600) return "1日前"; var dateArr = pastTime.split(' '); return (parseInt(difference / 86400)).toString() + '日前'; } </script> <style type="text/css"> #recent div { font-size:80%; color: } #recent ul { list-style:none; border-top:1px dotted #ccc; margin:0; padding:0; } #recent li { border-bottom:1px dotted #ccc; list-style:none; clear:both; overflow:hidden; margin:0; padding:5px 0; } #recent a.prof { float:left; width:48px; height:48px; overflow:hidden; margin:0; padding:3px 0; } #recent p { margin:0; padding:0; } #recent div { margin:0 0 0 58px; padding:0; } #recent p.footer, #recent p.rt { color:#666; margin-top:5px; } #recent p.rt { background:transparent url(/content/img/topic/twitter/rt.gif) no-repeat 0 0; overflow:hidden; padding-left:16px; min-height:15px; height:auto!important; height:15px; } </style> </head> <body> <div id="wrap"> <h1>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</h1> <p>指定したユーザーの公式RT含まない最新のツイートを20件(1ページ分)取得します。</p> <!-- CODE --> <div id="recent"></div> <!-- / CODE --> </div> </body> </html>
■ screen_name + count + include_rts
例)@cocoismの最新のツイート10件を取得(公式RT含む)
公式RTは、statuses/status/retweeted_statusに入っています。
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&count=10&include_rts=1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="/content/lib/jquery/jquery.jsonp.js"></script> <!-- JS --> <script type="text/javascript"> $(function(){ var url="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&include_rts=1&count=10&callback={callback}"; $.getJSONP(url, function(json){ var s=""; for(var i in json){ s+="<li>"; if(json[i].retweeted_status){ s+="<a href='http://twitter.com!/"+json[i].retweeted_status.user.screen_name+"' class='prof'><img src='"+json[i].retweeted_status.user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p class='footer'><a href='https://twitter.com!/"+json[i].retweeted_status.user.screen_name+"/status/"+json[i].retweeted_status.id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].retweeted_status.source+"から</p>"; s+="<p class='rt'>"+json[i].user.screen_name+"がリツイート</p>"; s+="</div>"; }else{ s+="<a href='http://twitter.com!/"+json[i].user.screen_name+"' class='prof'><img src='"+json[i].user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p><a href='https://twitter.com!/"+json[i].user.screen_name+"/status/"+json[i].id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].source+"から</p>"; s+="</div>"; } s+="</li>"; } $("#recent").html("<ul>"+s+"</ul>"); }); }); // リンク内につぶやきを含むURLに変更 function formatTwitterString(str){ str = str.replace(/((ftp|http|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>'); str = str.replace(/@(\w+)/gm,'<a href="http://twitter.com/$1" target="_blank">@$1</a>'); str = str.replace((\w+)/gm,'<a href="http://search.twitter.com/search?q=$1" target="_blank">#$1</a>'); return str; } function relativeTime(pastTime){ var origStamp = Date.parse(pastTime); var curDate = new Date(); var currentStamp = curDate.getTime(); var difference = parseInt((currentStamp - origStamp)/1000); if(difference < 0) return false; if(difference <= 5) return "いまさっき"; if(difference <= 20) return "数秒前"; if(difference <= 60) return "1分以内"; if(difference < 3600) return parseInt(difference/60)+" 分前"; if(difference <= 1.5*3600) return "1時間前"; if(difference < 23.5*3600) return Math.round(difference/3600)+" 時間前"; if(difference < 1.5*24*3600) return "1日前"; var dateArr = pastTime.split(' '); return (parseInt(difference / 86400)).toString() + '日前'; } </script> <style type="text/css"> #recent div { font-size:80%; color: } #recent ul { list-style:none; border-top:1px dotted #ccc; margin:0; padding:0; } #recent li { border-bottom:1px dotted #ccc; list-style:none; clear:both; overflow:hidden; margin:0; padding:5px 0; } #recent a.prof { float:left; width:48px; height:48px; overflow:hidden; margin:0; padding:3px 0; } #recent p { margin:0; padding:0; } #recent div { margin:0 0 0 58px; padding:0; } #recent p.footer, #recent p.rt { color:#666; margin-top:5px; } #recent p.rt { background:transparent url(/content/img/topic/twitter/rt.gif) no-repeat 0 0; overflow:hidden; padding-left:16px; min-height:15px; height:auto!important; height:15px; } </style> </head> <body> <div id="wrap"> <h1>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</h1> <p>指定したユーザーの公式RT含む最新のツイートを10件取得します。</p> <!-- CODE --> <div id="recent"></div> <!-- / CODE --> </div> </body> </html>
■ screen_name + since_id
例)@cocoismのステータスID「67854231561969664」より新しい最新のツイートを20件取得(指定したステータスIDは含まれません)。
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&since_id=67854231561969664
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="/content/lib/jquery/jquery.jsonp.js"></script> <!-- JS --> <script type="text/javascript"> $(function(){ //公式RT含まず //var url="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&since_id=67854231561969664&callback={callback}"; //公式RT含む var url="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&since_id=67854231561969664&include_rts=1&callback={callback}"; $.getJSONP(url, function(json){ var s=""; for(var i in json){ s+="<li>"; if(json[i].retweeted_status){ s+="<a href='http://twitter.com!/"+json[i].retweeted_status.user.screen_name+"' class='prof'><img src='"+json[i].retweeted_status.user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p class='footer'><a href='https://twitter.com!/"+json[i].retweeted_status.user.screen_name+"/status/"+json[i].retweeted_status.id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].retweeted_status.source+"から</p>"; s+="<p class='rt'>"+json[i].user.screen_name+"がリツイート</p>"; s+="</div>"; }else{ s+="<a href='http://twitter.com!/"+json[i].user.screen_name+"' class='prof'><img src='"+json[i].user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p><a href='https://twitter.com!/"+json[i].user.screen_name+"/status/"+json[i].id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].source+"から</p>"; s+="</div>"; } s+="</li>"; } $("#recent").html("<ul>"+s+"</ul>"); }); }); // リンク内につぶやきを含むURLに変更 function formatTwitterString(str){ str = str.replace(/((ftp|http|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>'); str = str.replace(/@(\w+)/gm,'<a href="http://twitter.com/$1" target="_blank">@$1</a>'); str = str.replace((\w+)/gm,'<a href="http://search.twitter.com/search?q=$1" target="_blank">#$1</a>'); return str; } function relativeTime(pastTime){ var origStamp = Date.parse(pastTime); var curDate = new Date(); var currentStamp = curDate.getTime(); var difference = parseInt((currentStamp - origStamp)/1000); if(difference < 0) return false; if(difference <= 5) return "いまさっき"; if(difference <= 20) return "数秒前"; if(difference <= 60) return "1分以内"; if(difference < 3600) return parseInt(difference/60)+" 分前"; if(difference <= 1.5*3600) return "1時間前"; if(difference < 23.5*3600) return Math.round(difference/3600)+" 時間前"; if(difference < 1.5*24*3600) return "1日前"; var dateArr = pastTime.split(' '); return (parseInt(difference / 86400)).toString() + '日前'; } </script> <style type="text/css"> #recent div { font-size:80%; color: } #recent ul { list-style:none; border-top:1px dotted #ccc; margin:0; padding:0; } #recent li { border-bottom:1px dotted #ccc; list-style:none; clear:both; overflow:hidden; margin:0; padding:5px 0; } #recent a.prof { float:left; width:48px; height:48px; overflow:hidden; margin:0; padding:3px 0; } #recent p { margin:0; padding:0; } #recent div { margin:0 0 0 58px; padding:0; } #recent p.footer, #recent p.rt { color:#666; margin-top:5px; } #recent p.rt { background:transparent url(/content/img/topic/twitter/rt.gif) no-repeat 0 0; overflow:hidden; padding-left:16px; min-height:15px; height:auto!important; height:15px; } </style> </head> <body> <div id="wrap"> <h1>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</h1> <p>指定したユーザーの指定したつぶやきIDより新しいつぶやきを最大20件取得します。指定したつぶやきIDは含まれません。</p> <!-- CODE --> <div id="recent"></div> <!-- / CODE --> </div> </body> </html>
■ screen_name + max_id
例)@cocoismのステータスID「67854231561969664」より過去のツイートを20件取得します(指定したステータスIDも含まれる)。
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&max_id=67854231561969664
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="/content/lib/jquery/jquery.jsonp.js"></script> <!-- JS --> <script type="text/javascript"> $(function(){ //公式RT含まず //var url="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&max_id=67854231561969664&callback={callback}"; //公式RT含む var url="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoism&max_id=67854231561969664&include_rts=1&callback={callback}"; $.getJSONP(url, function(json){ var s=""; for(var i in json){ s+="<li>"; if(json[i].retweeted_status){ s+="<a href='http://twitter.com!/"+json[i].retweeted_status.user.screen_name+"' class='prof'><img src='"+json[i].retweeted_status.user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p class='footer'><a href='https://twitter.com!/"+json[i].retweeted_status.user.screen_name+"/status/"+json[i].retweeted_status.id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].retweeted_status.source+"から</p>"; s+="<p class='rt'>"+json[i].user.screen_name+"がリツイート</p>"; s+="</div>"; }else{ s+="<a href='http://twitter.com!/"+json[i].user.screen_name+"' class='prof'><img src='"+json[i].user.profile_image_url+"' /></a>"; s+="<div>"; s+="<p class='tweet'>"+formatTwitterString(json[i].text)+"</p>"; s+="<p><a href='https://twitter.com!/"+json[i].user.screen_name+"/status/"+json[i].id_str+"'>"+relativeTime(json[i].created_at)+"</a> "+json[i].source+"から</p>"; s+="</div>"; } s+="</li>"; } $("#recent").html("<ul>"+s+"</ul>"); }); }); // リンク内につぶやきを含むURLに変更 function formatTwitterString(str){ str = str.replace(/((ftp|http|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>'); str = str.replace(/@(\w+)/gm,'<a href="http://twitter.com/$1" target="_blank">@$1</a>'); str = str.replace((\w+)/gm,'<a href="http://search.twitter.com/search?q=$1" target="_blank">#$1</a>'); return str; } function relativeTime(pastTime){ var origStamp = Date.parse(pastTime); var curDate = new Date(); var currentStamp = curDate.getTime(); var difference = parseInt((currentStamp - origStamp)/1000); if(difference < 0) return false; if(difference <= 5) return "いまさっき"; if(difference <= 20) return "数秒前"; if(difference <= 60) return "1分以内"; if(difference < 3600) return parseInt(difference/60)+" 分前"; if(difference <= 1.5*3600) return "1時間前"; if(difference < 23.5*3600) return Math.round(difference/3600)+" 時間前"; if(difference < 1.5*24*3600) return "1日前"; var dateArr = pastTime.split(' '); return (parseInt(difference / 86400)).toString() + '日前'; } </script> <style type="text/css"> #recent div { font-size:80%; color: } #recent ul { list-style:none; border-top:1px dotted #ccc; margin:0; padding:0; } #recent li { border-bottom:1px dotted #ccc; list-style:none; clear:both; overflow:hidden; margin:0; padding:5px 0; } #recent a.prof { float:left; width:48px; height:48px; overflow:hidden; margin:0; padding:3px 0; } #recent p { margin:0; padding:0; } #recent div { margin:0 0 0 58px; padding:0; } #recent p.footer, #recent p.rt { color:#666; margin-top:5px; } #recent p.rt { background:transparent url(/content/img/topic/twitter/rt.gif) no-repeat 0 0; overflow:hidden; padding-left:16px; min-height:15px; height:auto!important; height:15px; } </style> </head> <body> <div id="wrap"> <h1>Twitter REST API:タイムライン関連:user_timeline(指定したユーザーのタイムラインを取得) | 設置サンプル</h1> <h2>id + max_id</h2> <p>指定したユーザーの指定したつぶやきID以前のつぶやきを最大20件取得します。指定したつぶやきIDも含まれます。</p> <!-- CODE --> <div id="recent"></div> <!-- / CODE --> </div> </body> </html>
statuses/mentions
認証ユーザーの@ユーザー名の返信リストを取得(要認証)
2009/7/18
http://api.twitter.com/1/statuses/mentions.[xml|json|rss|atom]
Mentionsは、認証ユーザー宛の最新のリプライ(@返信)を20件取得します。 最大で、過去800件分のリプライを取得することができます。 取得結果は、Twitter公式サイトの「@関連」と同じです。
※パラメータ「include_rts」を指定した場合、結果の受取形式をXMLまたはJSONにしていると公式RTは含まれませんが、RSS、Atomの場合は、公式RTを含むツイートが返ります。
パラメーター
パラメーター | 説明 | |
---|---|---|
since_id | 任意 | 指定したステータスIDより後の最新のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/mentions.xml?since_id=12345 |
max_id | 任意 | 指定したステータスIDより過去のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/mentions.xml?max_id=12345 |
count | 任意 | 結果として受け取る件数を指定します。 例)http://api.twitter.com/1/statuses/mentions.xml?count=10 |
page | 任意 | 指定したページ番号(1ページ20件)のツイートを取得したい場合に使用。 例)http://api.twitter.com/1/statuses/mentions.xml?page=1 |
trim_user | 任意 | ユーザー情報を詳細でなく、ユーザーIDだけにしたい場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/mentions.xml?trim_user=1 |
include_rts | 任意 | リツイートを含めたユーザータイムラインを取得する場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/mentions.xml?include_rts=1 |
include_entities | 任意 | ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/mentions.xml?include_entities=1 |
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:50:50 +0000 2011</created_at> <id>67496736557498368</id> <text>@cocoism Googleのトップは季節感が楽しめるねー♪</text> <source>web</source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id>7948862</in_reply_to_user_id> <in_reply_to_screen_name>cocoism</in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>55984769</id> <name>PJRPJRPJRPJRPJRPJRPJ</name> <screen_name>pjroomer</screen_name> <location>とうきょう</location> <description>いやんばか。</description> <profile_image_url>http://a2.twimg.com/sticky/default_profile_images/default_profile_1_normal.png</profile_image_url> <url>http://www.hoge.com/ajierjaowejraojioejr#abut</url> <protected>false</protected> <followers_count>9</followers_count> <profile_background_color>C0DEED</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>0084B4</profile_link_color> <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color> <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color> <friends_count>191</friends_count> <created_at>Sun Jul 12 01:37:21 +0000 2009</created_at> <favourites_count>99</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a3.twimg.com/a/1304464034/images/themes/theme1/bg.png</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>true</following> <statuses_count>1387</statuses_count> <lang>ja</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>4</listed_count> <show_all_inline_media>false</show_all_inline_media> <default_profile>true</default_profile> <default_profile_image>true</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </status> </statuses>
json[0]['text']=@cocoism Googleのトップは季節感が楽しめるねー♪ json[0]['coordinates']= json[0]['truncated']= json[0]['id_str']=67496736557498368 json[0]['source']=web json[0]['geo']= json[0]['favorited']= json[0]['retweet_count']=0 json[0]['in_reply_to_screen_name']=cocoism json[0]['in_reply_to_status_id']= json[0]['in_reply_to_status_id_str']= json[0]['place']= json[0]['created_at']=Mon May 09 07:50:50 +0000 2011 json[0]['contributors']= json[0]['user']['profile_use_background_image']=1 json[0]['user']['follow_request_sent']= json[0]['user']['following']=1 json[0]['user']['friends_count']=191 json[0]['user']['profile_background_color']=C0DEED json[0]['user']['description']=いやんばか。 json[0]['user']['screen_name']=pjroomer json[0]['user']['show_all_inline_media']= json[0]['user']['geo_enabled']=1 json[0]['user']['profile_background_image_url']=http://a3.twimg.com/a/1304464034/images/themes/theme1/bg.png json[0]['user']['verified']= json[0]['user']['id_str']=55984769 json[0]['user']['is_translator']= json[0]['user']['profile_text_color']=333333 json[0]['user']['location']=とうきょう json[0]['user']['listed_count']=4 json[0]['user']['statuses_count']=1387 json[0]['user']['profile_sidebar_fill_color']=DDEEF6 json[0]['user']['contributors_enabled']= json[0]['user']['profile_background_tile']= json[0]['user']['url']=http://www.hoge.com/ajierjaowejraojioejr#abut json[0]['user']['lang']=ja json[0]['user']['followers_count']=9 json[0]['user']['protected']= json[0]['user']['notifications']= json[0]['user']['time_zone']=Tokyo json[0]['user']['created_at']=Sun Jul 12 01:37:21 +0000 2009 json[0]['user']['profile_link_color']=0084B4 json[0]['user']['name']=PJRPJRPJRPJRPJRPJRPJ json[0]['user']['default_profile_image']=1 json[0]['user']['default_profile']=1 json[0]['user']['profile_sidebar_border_color']=C0DEED json[0]['user']['id']=55984769 json[0]['user']['utc_offset']=32400 json[0]['user']['favourites_count']=99 json[0]['user']['profile_image_url']=http://a2.twimg.com/sticky/default_profile_images/default_profile_1_normal.png json[0]['retweeted']= json[0]['id']=6.74967365575E+16 json[0]['in_reply_to_user_id_str']=7948862 json[0]['in_reply_to_user_id']=7948862
statuses/retweeted_by_me
認証ユーザーが投稿したReTweet(引用返信)最新20件取得(要認証)
2009/7/18
http://api.twitter.com/1/statuses/retweeted_by_me.[xml|json|atom]
認証ユーザーが投稿した公式RTを最新20件取得します。
パラメーター
パラメーター | 説明 | |
---|---|---|
since_id | 任意 | 指定したステータスIDより後の最新のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweeted_by_me.xml?since_id=12345 |
max_id | 任意 | 指定したステータスIDより過去のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweeted_by_me.xml?max_id=54321 |
count | 任意 | 結果として受け取る件数を指定します。 例: http://api.twitter.com/1/statuses/retweeted_by_me.xml?count=5 |
page | 任意 | 指定したページ番号(1ページ20件)のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweeted_by_me.xml?page=3 |
trim_user | 任意 | ユーザー情報を詳細でなく、ユーザーIDだけにしたい場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/retweeted_by_me.xml?trim_user=1 |
include_entities | 任意 | ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/retweeted_by_me.xml?include_entities=1 |
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:55:32 +0000 2011</created_at> <id>67497920307531776</id> <text>RT @pjroomer: @cocoism Googleのトップは季節感が楽しめるねー♪</text> <source>web</source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <retweeted_status> <created_at>Mon May 09 07:50:50 +0000 2011</created_at> <id>67496736557498368</id> <text>@cocoism Googleのトップは季節感が楽しめるねー♪</text> <source>web</source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id>7948862</in_reply_to_user_id> <in_reply_to_screen_name>cocoism</in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>55984769</id> <name>PJRPJRPJRPJRPJRPJRPJ</name> <screen_name>pjroomer</screen_name> <location>とうきょう</location> <description>いやんばか。</description> <profile_image_url>http://a2.twimg.com/sticky/default_profile_images/default_profile_1_normal.png</profile_image_url> <url>http://www.hoge.com/ajierjaowejraojioejr#abut</url> <protected>false</protected> <followers_count>9</followers_count> <profile_background_color>C0DEED</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>0084B4</profile_link_color> <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color> <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color> <friends_count>191</friends_count> <created_at>Sun Jul 12 01:37:21 +0000 2009</created_at> <favourites_count>99</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a3.twimg.com/a/1304464034/images/themes/theme1/bg.png</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>false</following> <statuses_count>1387</statuses_count> <lang>ja</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>4</listed_count> <show_all_inline_media>false</show_all_inline_media> <default_profile>true</default_profile> <default_profile_image>true</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </retweeted_status> <user> <id>7948862</id> <name>つんつ</name> <screen_name>cocoism</screen_name> <location>カワタマ or オモサン</location> <description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description> <profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url> <url>http://phpjavascriptroom.com/</url> <protected>false</protected> <followers_count>594</followers_count> <profile_background_color>8350a1</profile_background_color> <profile_text_color>f2afcf</profile_text_color> <profile_link_color>f2afcf</profile_link_color> <profile_sidebar_fill_color>8350a1</profile_sidebar_fill_color> <profile_sidebar_border_color>8350a1</profile_sidebar_border_color> <friends_count>512</friends_count> <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at> <favourites_count>430</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a2.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url> <profile_background_tile>true</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>true</following> <statuses_count>4805</statuses_count> <lang>ja</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>52</listed_count> <show_all_inline_media>true</show_all_inline_media> <default_profile>false</default_profile> <default_profile_image>false</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </status> </statuses>
json[0]['retweeted_status]['text']=@cocoism Googleのトップは季節感が楽しめるねー♪ json[0]['retweeted_status]['coordinates']= json[0]['retweeted_status]['truncated']= json[0]['retweeted_status]['id_str']=67496736557498368 json[0]['retweeted_status]['source']=web json[0]['retweeted_status]['geo']= json[0]['retweeted_status]['favorited']= json[0]['retweeted_status]['retweet_count']=0 json[0]['retweeted_status]['in_reply_to_screen_name']=cocoism json[0]['retweeted_status]['in_reply_to_status_id']= json[0]['retweeted_status]['in_reply_to_status_id_str']= json[0]['retweeted_status]['place']= json[0]['retweeted_status]['created_at']=Mon May 09 07:50:50 +0000 2011 json[0]['retweeted_status]['contributors']= json[0]['retweeted_status]['user']=Array json[0]['retweeted_status]['retweeted']= json[0]['retweeted_status]['id']=6.74967365575E+16 json[0]['retweeted_status]['in_reply_to_user_id_str']=7948862 json[0]['retweeted_status]['in_reply_to_user_id']=7948862 json[0]['text']=RT @pjroomer: @cocoism Googleのトップは季節感が楽しめるねー♪ json[0]['coordinates']= json[0]['truncated']= json[0]['id_str']=67497920307531776 json[0]['source']=web json[0]['geo']= json[0]['favorited']= json[0]['retweet_count']=0 json[0]['in_reply_to_screen_name']= json[0]['in_reply_to_status_id']= json[0]['in_reply_to_status_id_str']= json[0]['place']= json[0]['created_at']=Mon May 09 07:55:32 +0000 2011 json[0]['contributors']= json[0]['user']['default_profile_image']= json[0]['user']['profile_use_background_image']=1 json[0]['user']['following']= json[0]['user']['profile_background_color']=8350a1 json[0]['user']['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[0]['user']['screen_name']=cocoism json[0]['user']['profile_background_image_url']=http://a2.twimg.com/profile_background_images/187449144/02.png json[0]['user']['follow_request_sent']= json[0]['user']['verified']= json[0]['user']['friends_count']=512 json[0]['user']['id_str']=7948862 json[0]['user']['statuses_count']=4805 json[0]['user']['profile_text_color']=f2afcf json[0]['user']['location']=カワタマ or オモサン json[0]['user']['geo_enabled']=1 json[0]['user']['profile_sidebar_fill_color']=8350a1 json[0]['user']['is_translator']= json[0]['user']['profile_background_tile']=1 json[0]['user']['url']=http://phpjavascriptroom.com/ json[0]['user']['listed_count']=52 json[0]['user']['lang']=ja json[0]['user']['followers_count']=594 json[0]['user']['protected']= json[0]['user']['notifications']= json[0]['user']['time_zone']=Tokyo json[0]['user']['created_at']=Sat Aug 04 05:52:33 +0000 2007 json[0]['user']['profile_link_color']=f2afcf json[0]['user']['name']=つんつ json[0]['user']['default_profile']= json[0]['user']['profile_sidebar_border_color']=8350a1 json[0]['user']['id']=7948862 json[0]['user']['show_all_inline_media']=1 json[0]['user']['contributors_enabled']= json[0]['user']['utc_offset']=32400 json[0]['user']['favourites_count']=430 json[0]['user']['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[0]['retweeted']= json[0]['id']=6.74979203075E+16 json[0]['in_reply_to_user_id_str']= json[0]['in_reply_to_user_id']=
statuses/retweeted_to_me
フォローしている人が投稿したReTweet(引用返信)最新20件取得(要認証)
2009/7/18
http://api.twitter.com/1/statuses/retweeted_to_me.[xml|json|atom]
認証ユーザーのフレンド(フォローしている人)が投稿した公式RTを最新20件取得します。
パラメーター
パラメーター | 説明 | |
---|---|---|
since_id | 任意 | 指定したステータスIDより後の最新のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweeted_to_me.xml?since_id=12345 |
max_id | 任意 | 指定したステータスIDより過去のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweeted_to_me.xml?max_id=54321 |
count | 任意 | 結果として受け取る件数を指定します。 例: http://api.twitter.com/1/statuses/retweeted_to_me.xml?count=5 |
page | 任意 | 指定したページ番号(1ページ20件)のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweeted_to_me.xml?page=3 |
trim_user | 任意 | ユーザー情報を詳細でなく、ユーザーIDだけにしたい場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/retweeted_to_me.xml?trim_user=1 |
include_entities | 任意 | ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/retweeted_to_me.xml?include_entities=1 |
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:49:14 +0000 2011</created_at> <id>67496335158427648</id> <text>RT @auster82194: wow ! paris hilton is trending right now haha im so excited to her visit here in the philippines :)</text> <source>web</source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <retweeted_status> <created_at>Mon May 09 05:45:42 +0000 2011</created_at> <id>67465245991514112</id> <text>wow ! paris hilton is trending right now haha im so excited to her visit here in the philippines :)</text> <source>web</source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>135181760</id> <name>Auster Rubio </name> <screen_name>auster82194</screen_name> <location>Manila , Philippines :))</location> <description> </description> <profile_image_url>http://a0.twimg.com/profile_images/1314631848/188897_199985576689293_100000335568494_630774_4991589_n__2__normal.jpg</profile_image_url> <url>http://www.facebook.com/profile.php?id=100000183126345</url> <protected>false</protected> <followers_count>19</followers_count> <profile_background_color>C0DEED</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>0084B4</profile_link_color> <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color> <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color> <friends_count>116</friends_count> <created_at>Tue Apr 20 15:23:37 +0000 2010</created_at> <favourites_count>2</favourites_count> <utc_offset></utc_offset> <time_zone></time_zone> <profile_background_image_url>http://a3.twimg.com/a/1304436748/images/themes/theme1/bg.png</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>false</geo_enabled> <verified>false</verified> <following>false</following> <statuses_count>1143</statuses_count> <lang>en</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>1</listed_count> <show_all_inline_media>false</show_all_inline_media> <default_profile>true</default_profile> <default_profile_image>false</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </retweeted_status> <user> <id>24929621</id> <name>Paris Hilton</name> <screen_name>ParisHilton</screen_name> <location>ÜT: 35.975487,-115.141709</location> <description>Model, Actress, Singer, Brand, Business Woman, Fashion Designer, Author, Philanthropist and Empire.</description> <profile_image_url>http://a3.twimg.com/profile_images/1331197954/6a0120a76ec06f970b01538e2fd977970b-500wi_normal.jpg</profile_image_url> <url>http://www.ParisHilton.com</url> <protected>false</protected> <followers_count>3909700</followers_count> <profile_background_color>ff66c9</profile_background_color> <profile_text_color>544640</profile_text_color> <profile_link_color>e872c5</profile_link_color> <profile_sidebar_fill_color>E5507E</profile_sidebar_fill_color> <profile_sidebar_border_color>CC3366</profile_sidebar_border_color> <friends_count>1909</friends_count> <created_at>Tue Mar 17 18:45:05 +0000 2009</created_at> <favourites_count>708</favourites_count> <utc_offset>-28800</utc_offset> <time_zone>Pacific Time (US & Canada)</time_zone> <profile_background_image_url>http://a1.twimg.com/profile_background_images/242312905/6a0120a76ec06f970b01538e2fd977970b-500wi.jpg</profile_background_image_url> <profile_background_tile>true</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>false</geo_enabled> <verified>true</verified> <following>true</following> <statuses_count>7421</statuses_count> <lang>en</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>45806</listed_count> <show_all_inline_media>false</show_all_inline_media> <default_profile>false</default_profile> <default_profile_image>false</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </status> </statuses>
json[0]['retweeted_status]['text']=wow ! paris hilton is trending right now haha im so excited to her visit here in the philippines :) json[0]['retweeted_status]['coordinates']= json[0]['retweeted_status]['truncated']= json[0]['retweeted_status]['id_str']=67465245991514112 json[0]['retweeted_status]['source']=web json[0]['retweeted_status]['geo']= json[0]['retweeted_status]['favorited']= json[0]['retweeted_status]['retweet_count']=0 json[0]['retweeted_status]['in_reply_to_screen_name']= json[0]['retweeted_status]['in_reply_to_status_id']= json[0]['retweeted_status]['in_reply_to_status_id_str']= json[0]['retweeted_status]['place']= json[0]['retweeted_status]['created_at']=Mon May 09 05:45:42 +0000 2011 json[0]['retweeted_status]['contributors']= json[0]['retweeted_status]['user']=Array json[0]['retweeted_status]['retweeted']= json[0]['retweeted_status]['id']=6.74652459915E+16 json[0]['retweeted_status]['in_reply_to_user_id_str']= json[0]['retweeted_status]['in_reply_to_user_id']= json[0]['text']=RT @auster82194: wow ! paris hilton is trending right now haha im so excited to her visit here in the philippines :) json[0]['coordinates']= json[0]['truncated']= json[0]['id_str']=67496335158427648 json[0]['source']=web json[0]['geo']= json[0]['favorited']= json[0]['retweet_count']=0 json[0]['in_reply_to_screen_name']= json[0]['in_reply_to_status_id']= json[0]['in_reply_to_status_id_str']= json[0]['place']= json[0]['created_at']=Mon May 09 07:49:14 +0000 2011 json[0]['contributors']= json[0]['user']['follow_request_sent']= json[0]['user']['profile_use_background_image']=1 json[0]['user']['friends_count']=1909 json[0]['user']['following']=1 json[0]['user']['profile_background_color']=ff66c9 json[0]['user']['description']=Model, Actress, Singer, Brand, Business Woman, Fashion Designer, Author, Philanthropist and Empire. json[0]['user']['screen_name']=ParisHilton json[0]['user']['default_profile']= json[0]['user']['profile_background_image_url']=http://a1.twimg.com/profile_background_images/242312905/6a0120a76ec06f970b01538e2fd977970b-500wi.jpg json[0]['user']['is_translator']= json[0]['user']['verified']=1 json[0]['user']['id_str']=24929621 json[0]['user']['listed_count']=45806 json[0]['user']['contributors_enabled']= json[0]['user']['profile_text_color']=544640 json[0]['user']['location']=ÜT: 35.975487,-115.141709 json[0]['user']['show_all_inline_media']= json[0]['user']['geo_enabled']= json[0]['user']['profile_sidebar_fill_color']=E5507E json[0]['user']['profile_background_tile']=1 json[0]['user']['url']=http://www.ParisHilton.com json[0]['user']['lang']=en json[0]['user']['followers_count']=3909758 json[0]['user']['protected']= json[0]['user']['default_profile_image']= json[0]['user']['statuses_count']=7421 json[0]['user']['notifications']= json[0]['user']['time_zone']=Pacific Time (US & Canada) json[0]['user']['created_at']=Tue Mar 17 18:45:05 +0000 2009 json[0]['user']['profile_link_color']=e872c5 json[0]['user']['name']=Paris Hilton json[0]['user']['profile_sidebar_border_color']=CC3366 json[0]['user']['id']=24929621 json[0]['user']['utc_offset']=-28800 json[0]['user']['favourites_count']=708 json[0]['user']['profile_image_url']=http://a3.twimg.com/profile_images/1331197954/6a0120a76ec06f970b01538e2fd977970b-500wi_normal.jpg json[0]['retweeted']= json[0]['id']=6.74963351584E+16 json[0]['in_reply_to_user_id_str']= json[0]['in_reply_to_user_id']=
statuses/retweets_of_me
認証ユーザーに対するReTweet(引用返信)最新20件取得(要認証)
2009/7/18
http://api.twitter.com/1/statuses/retweets_of_me.[xml|json|atom]
認証ユーザーのツイートの内、他ユーザーに公式RTされたツイートを最新20件取得します。
パラメーター
パラメーター | 説明 | |
---|---|---|
since_id | 任意 | 指定したステータスIDより後の最新のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweets_of_me.xml?since_id=12345 |
max_id | 任意 | 指定したステータスIDより過去のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweets_of_me.xml?max_id=54321 |
count | 任意 | 結果として受け取る件数を指定します。 例: http://api.twitter.com/1/statuses/retweets_of_me.xml?count=5 |
page | 任意 | 指定したページ番号(1ページ20件)のツイートを取得したい場合に使用。 例:http://api.twitter.com/1/statuses/retweets_of_me.xml?page=3 |
trim_user | 任意 | ユーザー情報を詳細でなく、ユーザーIDだけにしたい場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/retweets_of_me.xml?trim_user=1 |
include_entities | 任意 | ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/statuses/retweets_of_me.xml?include_entities=1 |
取得サンプル(XML/JSON)
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Mon May 09 07:35:57 +0000 2011</created_at> <id>67492990968545280</id> <text>ちわわんニュース紙 is out! http://bit.ly/gUy9AQ ▸ Top stories today via @to_mo_mo79 @takeshi_ice @tukuyo821029 @inunokurashi</text> <source><a href="http://paper.li" rel="nofollow">Paper.li</a></source> <truncated>false</truncated> <favorited>false</favorited> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count>0</retweet_count> <retweeted>false</retweeted> <user> <id>7948862</id> <name>つんつ</name> <screen_name>cocoism</screen_name> <location>カワタマ or オモサン</location> <description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description> <profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url> <url>http://phpjavascriptroom.com/</url> <protected>false</protected> <followers_count>594</followers_count> <profile_background_color>8350a1</profile_background_color> <profile_text_color>f2afcf</profile_text_color> <profile_link_color>f2afcf</profile_link_color> <profile_sidebar_fill_color>8350a1</profile_sidebar_fill_color> <profile_sidebar_border_color>8350a1</profile_sidebar_border_color> <friends_count>512</friends_count> <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at> <favourites_count>430</favourites_count> <utc_offset>32400</utc_offset> <time_zone>Tokyo</time_zone> <profile_background_image_url>http://a2.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url> <profile_background_tile>true</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>true</following> <statuses_count>4805</statuses_count> <lang>ja</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>52</listed_count> <show_all_inline_media>true</show_all_inline_media> <default_profile>false</default_profile> <default_profile_image>false</default_profile_image> <is_translator>false</is_translator> </user> <geo/> <coordinates/> <place/> <contributors/> </status> </statuses>
json[0]['text']=ちわわんニュース紙 is out! http://bit.ly/gUy9AQ ▸ Top stories today via @to_mo_mo79 @takeshi_ice @tukuyo821029 @inunokurashi json[0]['coordinates']= json[0]['truncated']= json[0]['id_str']=67492990968545280 json[0]['source']=Paper.li json[0]['geo']= json[0]['favorited']= json[0]['retweet_count']=0 json[0]['in_reply_to_screen_name']= json[0]['in_reply_to_status_id']= json[0]['in_reply_to_status_id_str']= json[0]['place']= json[0]['created_at']=Mon May 09 07:35:57 +0000 2011 json[0]['contributors']= json[0]['user']['contributors_enabled']= json[0]['user']['profile_use_background_image']=1 json[0]['user']['following']= json[0]['user']['profile_background_color']=8350a1 json[0]['user']['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[0]['user']['screen_name']=cocoism json[0]['user']['default_profile']= json[0]['user']['profile_background_image_url']=http://a2.twimg.com/profile_background_images/187449144/02.png json[0]['user']['default_profile_image']= json[0]['user']['verified']= json[0]['user']['id_str']=7948862 json[0]['user']['friends_count']=512 json[0]['user']['profile_text_color']=f2afcf json[0]['user']['location']=カワタマ or オモサン json[0]['user']['profile_sidebar_fill_color']=8350a1 json[0]['user']['follow_request_sent']= json[0]['user']['profile_background_tile']=1 json[0]['user']['url']=http://phpjavascriptroom.com/ json[0]['user']['show_all_inline_media']=1 json[0]['user']['lang']=ja json[0]['user']['geo_enabled']=1 json[0]['user']['followers_count']=594 json[0]['user']['protected']= json[0]['user']['notifications']= json[0]['user']['time_zone']=Tokyo json[0]['user']['created_at']=Sat Aug 04 05:52:33 +0000 2007 json[0]['user']['profile_link_color']=f2afcf json[0]['user']['name']=つんつ json[0]['user']['is_translator']= json[0]['user']['profile_sidebar_border_color']=8350a1 json[0]['user']['id']=7948862 json[0]['user']['listed_count']=52 json[0]['user']['statuses_count']=4805 json[0]['user']['utc_offset']=32400 json[0]['user']['favourites_count']=430 json[0]['user']['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[0]['retweeted']= json[0]['id']=6.74929909685E+16 json[0]['in_reply_to_user_id_str']= json[0]['in_reply_to_user_id']=