Statuses/comments by me/en

Jump to: navigation, search

Contents

statuses/comments_by_me

Return comments belong to the authenticating user.

URL

http://api.t.sina.com.cn/statuses/comments_by_me.(json%7Cxml)

Supported Formats

XML/JSON

HTTP Request Method

GET

Requires Authentication

true
See the Authorization Mechanism Statement for authorization details

Requests Count Limitation

true
See the Interface Access Rights Statement for the Request Count Limitaiton details.

Request Parameters

  Requires Type and Range Description
source true string AppKey for the application to identify it. ( This parameter is not needed when using OAuth)
since_id false int64 Returns then weibos with an ID greater than (that is, more recent than) the specified ID
max_id false int64 Return the weibos with an ID smaller than the specified ID.
count false int, default is 20, max is 200. Specify the number of weibos return.
page false int, default is 1. Specify results page. Based on the number of the authenticating user’s followings and the number of the followings’s weibos, the max number of weibos that page feature can access is different, usually up to about 1000 weibos.

Notes

None

Example Request

XML
curl -u "username:password" "http://api.t.sina.com.cn/statuses/comments_by_me.xml?source=appkey&count=5&page=2"
JSON
curl -u "username:password" "http://api.t.sina.com.cn/statuses/comments_by_me.json?source=appkey&count=5&page=2"

Response

XML Example

<comments>
  <comment>
    <created_at>Thu Nov 11 23:11:28 +0800 2010</created_at>
    <id>4439022969</id>
    <text>世界上最快的人~~~ They are just Genies~~</text>
    <user>
      <id>1658122963</id>
      <screen_name>zhangwei217245</screen_name>
      <name>zhangwei217245</name>
      <province>11</province>
      <city>5</city>
      <location>北京 朝阳区</location>
      <description>ABCDE</description>
      <url/>
      <profile_image_url>http://tp4.sinaimg.cn/1658122963/50/1282754213</profile_image_url>
      <domain>zhangwei217245</domain>
      <gender>m</gender>
      <followers_count>22</followers_count>
      <friends_count>43</friends_count>
      <statuses_count>0</statuses_count>
      <favourites_count>0</favourites_count>
      <created_at>Tue Nov 03 00:00:00 +0800 2009</created_at>
      <following>false</following>
      <verified>false</verified>
      <allow_all_act_msg>false</allow_all_act_msg>
      <geo_enabled>true</geo_enabled>
      <status>
        <created_at>Wed Dec 01 12:46:20 +0800 2010</created_at>
        <id>3995822273</id>
        <text>Twitter的API文档页面竟然有BUG。。。那个可以收缩的API列表。。。无语。</text>
        <source>
          <a href="">微博开放平台接口</a>
        </source>
        <favorited>false</favorited>
        <truncated>false</truncated>
        <geo/>
        <in_reply_to_status_id/>
        <in_reply_to_user_id/>
        <in_reply_to_screen_name/>
      </status>
    </user>
    <status>
      <created_at>Thu Nov 11 23:10:49 +0800 2010</created_at>
      <id>3583883787</id>
      <text>http://sinaurl.cn/7yJgU</text>
      <source>
        <a href="http://t.sina.com.cn">新浪微博</a>
      </source>
      <favorited>false</favorited>
      <truncated>false</truncated>
      <geo/>
      <in_reply_to_status_id/>
      <in_reply_to_user_id/>
      <in_reply_to_screen_name/>
      <user>
        <id>1658122963</id>
        <screen_name>zhangwei217245</screen_name>
        <name>zhangwei217245</name>
        <province>11</province>
        <city>5</city>
        <location>北京 朝阳区</location>
        <description>ABCDE</description>
        <url/>
        <profile_image_url>http://tp4.sinaimg.cn/1658122963/50/1282754213</profile_image_url>
        <domain>zhangwei217245</domain>
        <gender>m</gender>
        <followers_count>22</followers_count>
        <friends_count>43</friends_count>
        <statuses_count>0</statuses_count>
        <favourites_count>0</favourites_count>
        <created_at>Tue Nov 03 00:00:00 +0800 2009</created_at>
        <following>false</following>
        <verified>false</verified>
        <allow_all_act_msg>false</allow_all_act_msg>
        <geo_enabled>true</geo_enabled>
      </user>
    </status>
  </comment>
...
</comments>

JSON Example

[
    {
        "id" : 4439022969,
        "text" : "世界上最快的人~~~ They are just Genies~~",
        "created_at" : "Thu Nov 11 23:11:28 +0800 2010",
        "user" : 
        {
            "name" : "zhangwei217245",
            "domain" : "zhangwei217245",
            "geo_enabled" : true,
            "followers_count" : 22,
            "statuses_count" : 0,
            "favourites_count" : 0,
            "city" : "5",
            "description" : "ABCDE",
            "verified" : false,
            "status" : 
            {
                "created_at" : "Wed Dec 01 12:46:20 +0800 2010",
                "text" : "Twitter的API文档页面竟然有BUG。。。那个可以收缩的API列表。。。无语。",
                "truncated" : false,
                "in_reply_to_status_id" : "",
                "in_reply_to_screen_name" : "",
                "geo" : null,
                "favorited" : false,
                "in_reply_to_user_id" : "",
                "id" : 3995822273,
                "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>"
            },
            "id" : 1658122963,
            "gender" : "m",
            "friends_count" : 43,
            "screen_name" : "zhangwei217245",
            "allow_all_act_msg" : false,
            "following" : false,
            "url" : "",
            "profile_image_url" : "http://tp4.sinaimg.cn/1658122963/50/1282754213",
            "created_at" : "Tue Nov 03 00:00:00 +0800 2009",
            "province" : "11",
            "location" : "北京 朝阳区"
        },
        "status" : 
        {
            "created_at" : "Thu Nov 11 23:10:49 +0800 2010",
            "text" : "http://sinaurl.cn/7yJgU",
            "truncated" : false,
            "in_reply_to_status_id" : "",
            "in_reply_to_screen_name" : "",
            "geo" : null,
            "user" : 
            {
                "name" : "zhangwei217245",
                "domain" : "zhangwei217245",
                "geo_enabled" : true,
                "followers_count" : 22,
                "statuses_count" : 0,
                "favourites_count" : 0,
                "city" : "5",
                "description" : "ABCDE",
                "verified" : false,
                "id" : 1658122963,
                "gender" : "m",
                "friends_count" : 43,
                "screen_name" : "zhangwei217245",
                "allow_all_act_msg" : false,
                "following" : false,
                "url" : "",
                "profile_image_url" : "http://tp4.sinaimg.cn/1658122963/50/1282754213",
                "created_at" : "Tue Nov 03 00:00:00 +0800 2009",
                "province" : "11",
                "location" : "北京 朝阳区"
            },
            "favorited" : false,
            "in_reply_to_user_id" : "",
            "id" : 3583883787,
            "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
        }
    },
...
]

Field Description - comment

  • id: Comment ID
  • text: Comment content
  • source: Comment source
  • favorited: Whether it is favorited
  • truncated: Whether it is truncated
  • created_at: Created time
  • user: User profile that posts the comment.
  • status: The weibo that is commented
  • reply_comment Comment source. Has a same data structure as comment.

Field Description - user

  • id: User ID
  • screen_name: User’s nickname displayed on the home page
  • name: Friendly displayed name, the same as screen_name
  • province: Province code ( see Province and city code table)
  • city: City code ( see Province and city code table)
  • location:Address
  • description: Personal description
  • url: Url of the user’s blog
  • profile_image_url: Profile image
  • domain: The user’s personalized weibo url
  • gender: Gender, m—male, f- - female, n-- unknown
  • followers_count: Followers count
  • friends_count: Following count
  • statuses_count: Weibo count
  • favourites_count: Favorites count
  • created_at: Created time
  • following: Whether the current user is following the user that posts the weibo (Not supported yet)
  • verified: Whether the user is verified by his real identity, marked with “V”

Field Description - weibo

  • created_at: Create time
  • id: Weibo ID
  • text: Weibo content
  • source: Weibo source
  • favorited: Whether it is favroited
  • truncated: Whether it is truncated
  • in_reply_to_status_id: The reply’s ID
  • in_reply_to_user_id: UID of the replyer
  • in_reply_to_screen_name: Nickname of replyer
  • thumbnail_pic: Thumbnail picture
  • bmiddle_pic: Medium picture
  • original_pic:Original picture
  • user: User profile
  • retweeted_status: eposted weibo content, the content is the status, This filed is only available for a reposted weibo.

Others

Java Example

Please download Java SDK from . Weibo SDK Development Kit Dowload Site
Sample Code:

 public class GetCommentsByMe {
 
 	/**
 	 * 获取当前用户发表的评论列表 
 	 * @param args
 	 */
 	public static void main(String[] args) {
 	    System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
     	    System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
            try {
         	Weibo weibo = getWeibo(true,args);
         	List<Comment> comments = weibo.getCommentsByMe();
		for (Comment comment: comments){
		    System.out.println(comment.getId()+":"+comment.getText()+" by "+comment.getUser().getScreenName());
		}
 	    } catch (Exception e) {
 			e.printStackTrace();
            }
 	}
 
 	private static Weibo getWeibo(boolean isOauth,String ... args) {
 		Weibo weibo = new Weibo();
 		if(isOauth) {//oauth验证方式 args[0]:访问的token;args[1]:访问的密匙
 			weibo.setToken(args[0], args[1]);
 		}else {//用户登录方式
     		weibo.setUserId(args[0]);//用户名/ID
    		weibo.setPassword(args[1]);//密码
 		}
 		return weibo;
 	}
 }

PHP Example

Please download PHP SDK with OAUTH supported from Weibo SDK Development Kit Dowload Site
. Sample Code:

//statuses/comments_by_me
$c = new WeiboClient( WB_AKEY , 
                      WB_SKEY , 
                      $_SESSION['last_key']['oauth_token'] , 
                      $_SESSION['last_key']['oauth_token_secret']  );
$msg  = $c->comments_by_me();
if ($msg === false || $msg === null){
	echo "Error occured";
	return false;
}
if (isset($msg['error_code']) && isset($msg['error'])){
	echo ('Error_code: '.$msg['error_code'].';  Error: '.$msg['error'] );
	return false;
}
foreach ($msg as $data){
	$user_name = $data['user']['name'];
	$text = $data['text'];
	echo $user_name."=".$text.";";
}



文档更新时间: 20 January 2011