Contact Us
Back top
Current Location : APIs > 新浪微博
新浪微博 Transactions( 12328 )

新浪微博

Intro. :

Tag : 微博 On Shelves Time : 2016-12-12

Type :

文章 用户信息 指数 评论回复 分享 用户关系 评论

Tutorials

Total invocations(updated per hour)

新浪微博 1.00 yuan/100calls

API Mark

Example

注: 该接口为实时数据接口,可能受目标平台或网络调整影响存在一定错误率,建议程序中加入出错重试机制。
iDataAPI力求每个数据产口都为您提供稳定,持久的服务,平台上所有接口按成功调用次数收费,出错不收费,请放心使用。
Error Code
-- 请求示例 url 默认请求参数已经做URL编码 curl -i "http://api01.idataapi.cn:8000/post/weibo?apikey=您的APIKEY&kw=%E5%8C%97%E4%BA%AC"
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; import org.json.JSONException; import org.json.JSONObject; import java.io.PrintWriter; import java.net.URLConnection; public class Example { private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); PrintWriter out = new PrintWriter(conn.getOutputStream()); out.print(body); out.flush(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static void main(String[] args) throws IOException, JSONException { // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.idataapi.cn:8000/post/weibo?apikey=您的APIKEY&kw=%E5%8C%97%E4%BA%AC"; JSONObject json = getRequestFromUrl(url);; System.out.println(json.toString()); } }
//using System.Net.Security; //using System.Security.Cryptography.X509Certificates; private const String method = "GET"; static void Main(string[] args) { String bodys = ""; // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.idataapi.cn:8000/post/weibo?apikey=您的APIKEY&kw=%E5%8C%97%E4%BA%AC"; HttpWebRequest httpRequest = null; HttpWebResponse httpResponse = null; if (url.Contains("https://")) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url)); } else { httpRequest = (HttpWebRequest)WebRequest.Create(url); } httpRequest.Method = method; if (0 < bodys.Length) { byte[] data = Encoding.UTF8.GetBytes(bodys); using (Stream stream = httpRequest.GetRequestStream()) { stream.Write(data, 0, data.Length); } } try { httpResponse = (HttpWebResponse)httpRequest.GetResponse(); } catch (WebException ex) { httpResponse = (HttpWebResponse)ex.Response; } Console.WriteLine(httpResponse.StatusCode); Console.WriteLine(httpResponse.Method); Console.WriteLine(httpResponse.Headers); Stream st = httpResponse.GetResponseStream(); StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8")); Console.WriteLine(reader.ReadToEnd()); Console.WriteLine("\n"); } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
<?php $method = "GET"; // 请求示例 url 默认请求参数已经做URL编码 $url = "http://api01.idataapi.cn:8000/post/weibo?apikey=您的APIKEY&kw=%E5%8C%97%E4%BA%AC"; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip"); var_dump(curl_exec($curl)); ?>
# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ from __future__ import print_function import requests # 请求示例 url 默认请求参数已经做URL编码 url = "http://api01.idataapi.cn:8000/post/weibo?apikey=您的APIKEY&kw=%E5%8C%97%E4%BA%AC" headers = { "Accept-Encoding": "gzip", "Connection": "close" } if __name__ == "__main__": r = requests.get(url, headers=headers) json_obj = r.json() print(json_obj)

Request Field( Params marked* means users should choose one from the each marked items to fill in.)

Property Name Type Mandatory Example Description
kw string * 北京 查询关键词
uid string * 2709577332 用户id
id string * 4297018715177687
pageToken string 1 翻页值,从API返回结果可以拿到
date string 如:201701表示2017年01月
type string all 关键词搜索请求类型: 1、默认type=all返回全部微博; 2、type=hot返回热门微博; 3、type=original返回原创微博; 4、type=1返回实时微博。

Response Fields

Property Name Type Example Description
  • viewCount string null 浏览数/该接口无
  • -
    from object {...} 该微博发布者信息
    • +
      extend object {...} 该微博发布者更多信息
      • bi_followers_count number 2163 用户互粉数
      • domain string happyzhangjiang 用户的个性化域名
      • avatar_large string https://tva3.sinaimg.cn/crop.2.0.176.176.180/a180de74jw1ev38avqrrtj2052052t96.jpg 用户头像地址(大图),180×180像素
      • id number 2709577332 文章ID
      • city string 1000 用户所在城市ID
      • verified boolean true 是否是微博认证用户,即加V用户,true:是,false:否
      • verified_reason string 知名搞笑幽默博主 认证原因
      • followers_count number 9733096 粉丝数
      • location string 上海 用户所在地
      • profile_url string happyzhangjiang 用户的微博统一URL地址
      • province string 31 用户所在省级ID
      • avatar_hd string https://tva3.sinaimg.cn/crop.2.0.176.176.1024/a180de74jw1ev38avqrrtj2052052t96.jpg 用户头像地址(高清),高清头像原图
      • statuses_count number 41337 微博数
      • description string 每日搜集整理发布各类新鲜资讯,欢迎私信 用户个人描述
      • friends_count number 2286 关注数
      • idstr string 2709577332 字符串型的用户UID
      • allow_all_act_msg boolean true 是否允许所有人给我发私信,true:是,false:否
      • allow_all_comment boolean true 是否允许所有人对我的微博进行评论,true:是,false:否
      • geo_enabled boolean false 是否允许标识用户的地理位置,true:是,false:否
      • name string Happy张江 友好显示名称
      • lang string zh-cn 用户当前的语言版本,zh-cn:简体中文,zh-tw:繁体中文,en:英语
      • favourites_count number 5606 收藏数
      • screen_name string Happy张江 用户昵称
      • url string http://blog.sina.com.cn/happyzhangjiang 文章链接
      • gender string f 性别,m:男、f:女、n:未知
      • created_at string Tue Feb 07 09:56:31 0800 2012 创建时间
    • friendCount number 2286 关注数
    • fansCount number 9733096 粉丝数
    • likeCount number 13 被点赞数
    • postCount number 41337 微博数
  • -
    mblog object {...} 微博信息字段
    • reposts_count number 84 转发数
    • +
      retweeted_status object {...} 转发的微博字段
      • mblogid string F4huN2DCH 微博mblogid
      • text string 中国留学生毕业演讲:美国的空气都是新鲜而甜美的![并不简单]昨天美国马里兰大学举 微博内容
      • mid string 4110205690628971 微博mid
      • attitudes_count number 23 点赞数
      • comments_count number 244 评论数
      • user object {...} 用户信息字段
      • geo string null 地理信息
      • isLongText boolean false 是否长微博
  • title string null 文章标题
  • pDate string 2017-05-22 14:38:14 发布时间/北京时间
  • commentCount number 35 评论数
  • shareCount number 84 转发数
  • content string [拜拜]//@要和太阳肩并肩的小霸王萝莉: 跪舔的嘴脸真丑……//@努力奔跑的s 文章内容
  • imageURLs string null 图片链接
  • videoURLs string null 视频链接

Returns The Sample

{
    "viewCount": null,
    "from": {
        "extend": {
            "bi_followers_count": 2163,
            "domain": "happyzhangjiang",
            "avatar_large": "https:\/\/tva3.sinaimg.cn\/crop.2.0.176.176.180\/a180de74jw1ev38avqrrtj2052052t96.jpg",
            "id": 2709577332,
            "city": "1000",
            "verified": true,
            "verified_reason": "知名搞笑幽默博主",
            "followers_count": 9733096,
            "location": "上海",
            "profile_url": "happyzhangjiang",
            "province": "31",
            "avatar_hd": "https:\/\/tva3.sinaimg.cn\/crop.2.0.176.176.1024\/a180de74jw1ev38avqrrtj2052052t96.jpg",
            "statuses_count": 41337,
            "description": "每日搜集整理发布各类新鲜资讯,欢迎私信",
            "friends_count": 2286,
            "idstr": "2709577332",
            "allow_all_act_msg": true,
            "allow_all_comment": true,
            "geo_enabled": false,
            "name": "Happy张江",
            "lang": "zh-cn",
            "favourites_count": 5606,
            "screen_name": "Happy张江",
            "url": "http:\/\/blog.sina.com.cn\/happyzhangjiang",
            "gender": "f",
            "created_at": "Tue Feb 07 09:56:31 +0800 2012"
        },
        "name": "Happy张江",
        "friendCount": 2286,
        "url": "http:\/\/weibo.com\/2709577332\/F4hJSwLEc",
        "fansCount": 9733096,
        "likeCount": 13,
        "postCount": 41337,
        "id": "2709577332",
        "description": "每日搜集整理发布各类新鲜资讯,欢迎私信"
    },
    "mblog": {
        "reposts_count": 84,
        "retweeted_status": {
            "reposts_count": 242,
            "mblogid": "F4huN2DCH",
            "url": "http:\/\/weibo.com\/5558366461\/F4huN2DCH",
            "text": "中国留学生毕业演讲:美国的空气都是新鲜而甜美的![并不简单]昨天美国马里兰大学举行毕业典礼,中国留学生代表Shuping Yang演讲,但是姑娘说:中国空气肮脏不堪,美国的却是如此香甜(Excuse me?!)[费解]http:\/\/t.cn\/RadtoeY ​​​",
            "created_at": "Mon May 22 14:01:03 +0800 2017",
            "idstr": "4110205690628971",
            "mid": "4110205690628971",
            "attitudes_count": 23,
            "comments_count": 244,
            "user": {
                "bi_followers_count": 3,
                "domain": "",
                "avatar_large": "https:\/\/tva4.sinaimg.cn\/crop.1.4.224.224.180\/0064al1Xgw1evhjk8e89zj306c06st96.jpg",
                "id": 5558366461,
                "city": "1000",
                "verified": false,
                "verified_reason": "",
                "followers_count": 1366127,
                "location": "北京",
                "profile_url": "u\/5558366461",
                "province": "11",
                "avatar_hd": "https:\/\/tva4.sinaimg.cn\/crop.1.4.224.224.1024\/0064al1Xgw1evhjk8e89zj306c06st96.jpg",
                "statuses_count": 2326,
                "description": "你开心就好",
                "friends_count": 16,
                "idstr": "5558366461",
                "allow_all_act_msg": false,
                "allow_all_comment": true,
                "geo_enabled": true,
                "name": "极品爆料王",
                "lang": "zh-cn",
                "favourites_count": 0,
                "screen_name": "极品爆料王",
                "url": "http:\/\/blog.sina.com",
                "gender": "m",
                "created_at": "Tue Mar 17 00:44:06 +0800 2015"
            },
            "id": 4110205690628971,
            "geo": null,
            "isLongText": false
        },
        "mblogid": "F4hJSwLEc",
        "text": "[拜拜]\/\/@要和太阳肩并肩的小霸王萝莉: 跪舔的嘴脸真丑……\/\/@努力奔跑的stone: 小姑娘祝你好运 \/\/@得瑟米: 我靠[鄙视][吃惊][蜡烛]",
        "created_at": "Mon May 22 14:38:14 +0800 2017",
        "idstr": "4110215047809656",
        "mid": "4110215047809656",
        "attitudes_count": 13,
        "comments_count": 35,
        "id": 4110215047809656,
        "geo": null,
        "isLongText": false
    },
    "title": null,
    "url": "http:\/\/weibo.com\/2709577332\/F4hJSwLEc",
    "pDate": "2017-05-22 14:38:14",
    "likeCount": 13,
    "commentCount": 35,
    "shareCount": 84,
    "content": "[拜拜]\/\/@要和太阳肩并肩的小霸王萝莉: 跪舔的嘴脸真丑……\/\/@努力奔跑的stone: 小姑娘祝你好运 \/\/@得瑟米: 我靠[鄙视][吃惊][蜡烛]",
    "imageURLs": null,
    "id": "4110215047809656",
    "videoURLs": null
}

Detailed Data

No Details

状态码

Status Code Return Value Format : JSON

{

message:"API rate limit exceeded",

retcode:100703

}

The API in our platform is only paid when invoked successfully. For the detail, please refer to the below table.

Status Code Code Meaning Detailed Description Need paid or not?
000000 invoke successfully(data is not null) 成功调用并返回数据
100002 Search no result 目标参数搜索没结果
100000 Server internal error 服务器内部错误
100001 Network error 网络错误
100004 Target server error 目标服务器错误
100005 Param error 用户输入参数错误
100301 Account not found 用户帐号不存在
100700 Invalid authentication credentials 授权失败
100701 API stopped 您的当前API已停用
100702 Account stopped 您的账户已停用
100703 API rate limit exceeded 并发已达上限
100704 API maintenance API维护中
100705 API not found with these values API不存在
100706 Please add api first 请先添加api
100707 Number of calls exceeded 调用次数超限
100802 Missing url param 'time' or uri path is not equal to 2 请求路径错误或者缺少"time"参数
100803 Wrong pageToken 参数pageToken有误

Often With The Purchase Of Data