示例#1
0
        /// <summary>
        /// 获取空间信息
        /// </summary>
        /// <param name="Token">账户Token</param>
        /// <returns></returns>
        public static SpaceInfo GetSpace(string Token)
        {
            var ret = WebTool.GetHtml($"https://pcs.baidu.com/rest/2.0/pcs/quota?method=info&access_token={Token}");

            if (ret.Contains("ERROR"))
            {
                return(null);
            }
            return(JsonConvert.DeserializeObject <SpaceInfo>(WebTool.GetHtml($"https://pcs.baidu.com/rest/2.0/pcs/quota?method=info&access_token={Token}")));
        }
示例#2
0
        /// <summary>
        /// 获取用户名
        /// </summary>
        /// <param name="Token">账户Token</param>
        /// <returns></returns>
        public static string GetName(string Token)
        {
            var ret = WebTool.GetHtml($"https://openapi.baidu.com/rest/2.0/passport/users/getLoggedInUser?access_token={Token}");

            if (ret.Contains("ERROR"))
            {
                return(ret);
            }
            JObject json = JObject.Parse(ret);

            return((string)json["uname"]);
        }