Exemplo n.º 1
0
        public static string GetExchangeRate(string p1, string p2)
        {
            string url = "https://query.yahooapis.com/v1/public/yql?q=select%20id,Rate%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22";

            url += p1 + p2 + "%22%29&env=store://datatables.org/alltableswithkeys&format=json";
            string temp = HTTP.Get(url, "", 100000);
            JsonYahooExchangeRateModel ExchangeRateYahoo = (JsonYahooExchangeRateModel)JsonConvert.DeserializeObject(temp, typeof(JsonYahooExchangeRateModel));

            if (!ExchangeRateYahoo.query.results.rate.Rate.Equals("N/A"))
            {
                return("根据Yahoo!的信息," + ExchangeRateYahoo.query.results.rate.id + "在UTC" + ExchangeRateYahoo.query.created + "的汇率是:" + ExchangeRateYahoo.query.results.rate.Rate + "。");
            }
            url  = "https://www.cryptonator.com/api/ticker/" + p1 + "-" + p2;
            temp = HTTP.Get(url);
            JsonExchangeRateModel ExchangeRate = (JsonExchangeRateModel)JsonConvert.DeserializeObject(temp, typeof(JsonExchangeRateModel));

            if (ExchangeRate.success == true)
            {
                return("根据cryptonator的信息," + p1 + "-" + p2 + "的汇率:" + ExchangeRate.ticker.price);
            }
            else
            {
                return("Error:" + ExchangeRate.error);
            }
        }
Exemplo n.º 2
0
        internal static string GetCityInfo(string city, string target)
        {
            if ((!city.Equals("呼市郊区")) && (!city.Equals("津市")) && (!city.Equals("沙市")))
            {
                city = city.Replace("省", "");
                city = city.Replace("市", "");
            }
            city = city.Replace(" ", "");
            city = city.Replace("\r", "");
            city = city.Replace("\n", "");

            target = target.Replace(" ", "");
            target = target.Replace("\r", "");
            target = target.Replace("\n", "");
            string ans = "";

            string url  = "https://ruiruiqq.hxlxz.com/weather.php?city=" + city + "&type=forecast";
            string temp = HTTP.Get(url);

            if (temp.Equals("NoCity"))
            {
                return("未查询到指定城市 " + city + " 的信息");
            }

            JsonWeatherModel weather = (JsonWeatherModel)JsonConvert.DeserializeObject(temp, typeof(JsonWeatherModel));

            ans  = "城市 " + weather.c.c3 + "(" + weather.c.c2 + ") 的信息如下:" + Environment.NewLine;
            ans += "所在省市:" + weather.c.c7 + "省" + weather.c.c5 + "市" + "(" + weather.c.c6 + " " + weather.c.c4 + ")" + Environment.NewLine;
            ans += "区号:" + weather.c.c11 + ",邮编:" + weather.c.c12 + "。城市级别:" + weather.c.c10 + "级城市" + Environment.NewLine;
            ans += "经度:" + weather.c.c13 + ",纬度:" + weather.c.c14 + ",海拔:" + weather.c.c15 + "。雷达站" + weather.c.c16;
            return(ans);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 登录第三步:获取ptwebqq值
        /// </summary>
        /// <param name="url">获取ptwebqq的跳转地址</param>
        private static void Login_GetPtwebqq(string url)
        {
            string dat = HTTP.Get(url, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1");
            Uri    uri = new Uri("http://web2.qq.com/");

            ptwebqq = HTTP.cookies.GetCookies(uri)["ptwebqq"].Value;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取自己的信息
        /// </summary>
        internal static void Info_SelfInfo()
        {
            string             url = "http://s.web2.qq.com/api/get_self_info2?t=#{t}".Replace("#{t}", AID_TimeStamp());
            string             dat = HTTP.Get(url, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1");
            JsonFriendInfModel inf = (JsonFriendInfModel)JsonConvert.DeserializeObject(dat, typeof(JsonFriendInfModel));

            SelfInfo.face       = inf.result.face;
            SelfInfo.occupation = inf.result.occupation;
            SelfInfo.phone      = inf.result.phone;
            SelfInfo.college    = inf.result.college;
            SelfInfo.blood      = inf.result.blood;
            SelfInfo.homepage   = inf.result.homepage;
            SelfInfo.vip_info   = inf.result.vip_info;
            SelfInfo.country    = inf.result.country;
            SelfInfo.city       = inf.result.city;
            SelfInfo.personal   = inf.result.personal;
            SelfInfo.nick       = inf.result.nick;
            SelfInfo.shengxiao  = inf.result.shengxiao;
            SelfInfo.email      = inf.result.email;
            SelfInfo.province   = inf.result.province;
            SelfInfo.gender     = inf.result.gender;
            if (inf.result.birthday.year != 0 && inf.result.birthday.month != 0 && inf.result.birthday.day != 0)
            {
                SelfInfo.birthday = new DateTime(inf.result.birthday.year, inf.result.birthday.month, inf.result.birthday.day);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 登录第四步:获取vfwebqq的值
        /// </summary>
        private static void Login_GetVfwebqq()
        {
            string url = "http://s.web2.qq.com/api/getvfwebqq?ptwebqq=#{ptwebqq}&clientid=53999199&psessionid=&t=#{t}".Replace("#{ptwebqq}", ptwebqq).Replace("#{t}", AID_TimeStamp());
            string dat = HTTP.Get(url, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1");

            vfwebqq = dat.Split('\"')[7];
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取好友的详细信息
        /// </summary>
        /// <param name="uin"></param>
        internal static void Info_FriendInfo(string uin)
        {
            string url = "http://s.web2.qq.com/api/get_friend_info2?tuin=#{uin}&vfwebqq=#{vfwebqq}&clientid=53999199&psessionid=#{psessionid}&t=#{t}".Replace("#{t}", AID_TimeStamp());

            url = url.Replace("#{uin}", uin).Replace("#{vfwebqq}", vfwebqq).Replace("#{psessionid}", psessionid);
            string             dat = HTTP.Get(url, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1");
            JsonFriendInfModel inf = (JsonFriendInfModel)JsonConvert.DeserializeObject(dat, typeof(JsonFriendInfModel));

            if (!FriendList.ContainsKey(uin))
            {
                FriendList.Add(uin, new FriendInfo());
            }
            FriendList[uin].face       = inf.result.face;
            FriendList[uin].occupation = inf.result.occupation;
            FriendList[uin].phone      = inf.result.phone;
            FriendList[uin].college    = inf.result.college;
            FriendList[uin].blood      = inf.result.blood;
            FriendList[uin].homepage   = inf.result.homepage;
            FriendList[uin].vip_info   = inf.result.vip_info;
            FriendList[uin].country    = inf.result.country;
            FriendList[uin].city       = inf.result.city;
            FriendList[uin].personal   = inf.result.personal;
            FriendList[uin].nick       = inf.result.nick;
            FriendList[uin].shengxiao  = inf.result.shengxiao;
            FriendList[uin].email      = inf.result.email;
            FriendList[uin].province   = inf.result.province;
            FriendList[uin].gender     = inf.result.gender;
            if (inf.result.birthday.year != 0 && inf.result.birthday.month != 0 && inf.result.birthday.day != 0)
            {
                FriendList[uin].birthday = new DateTime(inf.result.birthday.year, inf.result.birthday.month, inf.result.birthday.day);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 登录第二步:检查二维码状态
        /// </summary>
        private static void Login_GetQRStatu()
        {
            string dat, ptqrtoken, qrsig;

            qrsig     = HTTP.cookies.GetCookies(new Uri("http://ptlogin2.qq.com"))["qrsig"].Value;
            ptqrtoken = AID_Hash33(qrsig).ToString();
            dat       = HTTP.Get("https://ssl.ptlogin2.qq.com/ptqrlogin?ptqrtoken=#{ptqrtoken}&webqq_type=10&remember_uin=1&login2qq=1&aid=501004106&u1=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&ptredirect=0&ptlang=2052&daid=164&from_ui=1&pttype=1&dumy=&fp=loginerroralert&0-0-157510&mibao_css=m_webqq&t=undefined&g=1&js_type=0&js_ver=10184&login_sig=&pt_randsalt=3".Replace("#{ptqrtoken}", ptqrtoken), "https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=16&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001");
            string[] temp = dat.Split('\'');
            switch (temp[1])
            {
            case ("65"):                                                //二维码失效
                Program.MainForm.labelQRStatu.Text = "当前登录状态:二维码失效,请稍后";
                Login_GetQRCode();
                break;

            case ("66"):                                                //等待扫描
                Program.MainForm.labelQRStatu.Text = "当前登录状态:二维码有效,请扫描";
                break;

            case ("67"):                                                //等待确认
                Program.MainForm.labelQRStatu.Text = "当前登录状态:二维码已扫描,请确认";
                break;

            case ("0"):                                                 //已经确认
                Program.MainForm.labelQRStatu.Text = "当前登录状态:确认成功,请稍候";
                Login_Process(temp[5]);
                break;

            default: break;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 登录第二步:检查二维码状态
        /// </summary>
        private static void Login_GetQRStatu()
        {
            string dat;

            dat = HTTP.Get("https://ssl.ptlogin2.qq.com/ptqrlogin?webqq_type=10&remember_uin=1&login2qq=1&aid=501004106 &u1=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10 &ptredirect=0&ptlang=2052&daid=164&from_ui=1&pttype=1&dumy=&fp=loginerroralert &action=0-0-157510&mibao_css=m_webqq&t=1&g=1&js_type=0&js_ver=10143&login_sig=&pt_randsalt=0", "https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=16&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1 &s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html&f_url=loginerroralert &strong_login=1&login_state=10&t=20131024001");
            string[] temp = dat.Split('\'');
            switch (temp[1])
            {
            case ("65"):                                                //二维码失效
                Program.MainForm.labelQRStatu.Text = "失效";
                Login_GetQRCode();
                break;

            case ("66"):                                                //等待扫描
                Program.MainForm.labelQRStatu.Text = "有效";
                break;

            case ("67"):                                                //等待确认
                Program.MainForm.labelQRStatu.Text = "等待";
                break;

            case ("0"):                                                 //已经确认
                Program.MainForm.labelQRStatu.Text = "成功";
                Login_Process(temp[5]);
                break;

            default: break;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取讨论组详细信息
        /// </summary>
        /// <param name="did"></param>
        internal static void Info_DisscussInfo(string did)
        {
            string url = "http://d1.web2.qq.com/channel/get_discu_info?did=#{discuss_id}&psessionid=#{psessionid}&vfwebqq=#{vfwebqq}&clientid=53999199&t=#{t}".Replace("#{t}", AID_TimeStamp());

            url = url.Replace("#{discuss_id}", did).Replace("#{psessionid}", psessionid).Replace("#{vfwebqq}", vfwebqq);
            string dat = HTTP.Get(url, "http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2");
            JsonDisscussInfoModel inf = (JsonDisscussInfoModel)JsonConvert.DeserializeObject(dat, typeof(JsonDisscussInfoModel));

            for (int i = 0; i < inf.result.mem_info.Count; i++)
            {
                if (!DisscussList[did].MemberList.ContainsKey(inf.result.mem_info[i].uin))
                {
                    DisscussList[did].MemberList.Add(inf.result.mem_info[i].uin, new DiscussInfo.MenberInfo());
                }
                DisscussList[did].MemberList[inf.result.mem_info[i].uin].nick = inf.result.mem_info[i].nick;
            }
            for (int i = 0; i < inf.result.mem_status.Count; i++)
            {
                if (!DisscussList[did].MemberList.ContainsKey(inf.result.mem_status[i].uin))
                {
                    DisscussList[did].MemberList.Add(inf.result.mem_status[i].uin, new DiscussInfo.MenberInfo());
                }
                DisscussList[did].MemberList[inf.result.mem_status[i].uin].status      = inf.result.mem_status[i].status;
                DisscussList[did].MemberList[inf.result.mem_status[i].uin].client_type = inf.result.mem_status[i].client_type;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 登录第六步:获取在线成员、近期联系人(仅提交请求,未处理)
        /// </summary>
        private static void Login_GetOnlineAndRecent_FAKE()
        {
            string url = "http://d1.web2.qq.com/channel/get_online_buddies2?vfwebqq=#{vfwebqq}&clientid=53999199&psessionid=#{psessionid}&t=#{t}".Replace("#{vfwebqq}", vfwebqq).Replace("#{psessionid}", psessionid).Replace("#{t}", AID_TimeStamp());

            HTTP.Get(url, "http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2");

            url = "http://d1.web2.qq.com/channel/get_recent_list2";
            string url1 = "{\"vfwebqq\":\"#{vfwebqq}\",\"clientid\":53999199,\"psessionid\":\"#{psessionid}\"}".Replace("#{vfwebqq}", vfwebqq).Replace("#{psessionid}", psessionid);
            string dat  = HTTP.Post(url, "r=" + HttpUtility.UrlEncode(url1), "http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2");
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取群的详细信息
        /// </summary>
        /// <param name="gid"></param>
        internal static void Info_GroupInfo(string gid)
        {
            if (!GroupList.ContainsKey(gid))
            {
                return;
            }
            string             gcode     = GroupList[gid].code;
            string             url       = "http://s.web2.qq.com/api/get_group_info_ext2?gcode=#{group_code}&vfwebqq=#{vfwebqq}&t=#{t}".Replace("#{group_code}", gcode).Replace("#{vfwebqq}", vfwebqq).Replace("#{t}", AID_TimeStamp());
            string             dat       = HTTP.Get(url, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1");
            JsonGroupInfoModel groupInfo = (JsonGroupInfoModel)JsonConvert.DeserializeObject(dat, typeof(JsonGroupInfoModel));

            GroupList[gid].name       = groupInfo.result.ginfo.name;
            GroupList[gid].createtime = groupInfo.result.ginfo.createtime;
            GroupList[gid].face       = groupInfo.result.ginfo.face;
            GroupList[gid].owner      = groupInfo.result.ginfo.owner;
            GroupList[gid].memo       = groupInfo.result.ginfo.memo;
            GroupList[gid].markname   = groupInfo.result.ginfo.markname;
            GroupList[gid].level      = groupInfo.result.ginfo.level;
            for (int i = 0; i < groupInfo.result.minfo.Count; i++)
            {
                if (!GroupList[gid].MemberList.ContainsKey(groupInfo.result.minfo[i].uin))
                {
                    GroupList[gid].MemberList.Add(groupInfo.result.minfo[i].uin, new GroupInfo.MenberInfo());
                }
                GroupList[gid].MemberList[groupInfo.result.minfo[i].uin].city     = groupInfo.result.minfo[i].city;
                GroupList[gid].MemberList[groupInfo.result.minfo[i].uin].province = groupInfo.result.minfo[i].province;
                GroupList[gid].MemberList[groupInfo.result.minfo[i].uin].country  = groupInfo.result.minfo[i].country;
                GroupList[gid].MemberList[groupInfo.result.minfo[i].uin].gender   = groupInfo.result.minfo[i].gender;
                GroupList[gid].MemberList[groupInfo.result.minfo[i].uin].nick     = groupInfo.result.minfo[i].nick;
            }
            if (groupInfo.result.cards != null)
            {
                for (int i = 0; i < groupInfo.result.cards.Count; i++)
                {
                    if (!GroupList[gid].MemberList.ContainsKey(groupInfo.result.cards[i].muin))
                    {
                        GroupList[gid].MemberList.Add(groupInfo.result.cards[i].muin, new GroupInfo.MenberInfo());
                    }
                    GroupList[gid].MemberList[groupInfo.result.cards[i].muin].card = groupInfo.result.cards[i].card;
                }
            }
            for (int i = 0; i < groupInfo.result.ginfo.members.Count; i++)
            {
                if (groupInfo.result.ginfo.members[i].mflag % 2 == 1)
                {
                    GroupList[gid].MemberList[groupInfo.result.ginfo.members[i].muin].isManager = true;
                }
                else
                {
                    GroupList[gid].MemberList[groupInfo.result.ginfo.members[i].muin].isManager = false;
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 登录第三步:获取ptwebqq值
        /// </summary>
        /// <param name="url">获取ptwebqq的跳转地址</param>
        private static void Login_GetPtwebqq(string url)
        {
            string dat = HTTP.Get(url, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1");
            Uri    uri = new Uri("http://web2.qq.com/");

            ptwebqq = HTTP.cookies.GetCookies(uri)["ptwebqq"].Value;
            //p_skey = HTTP.cookies.GetCookies(uri)["p_skey"].Value;
            //MyUin = HTTP.cookies.GetCookies(uri)["uin"].Value;
            //skey = HTTP.cookies.GetCookies(uri)["skey"].Value;
            //p_uin = HTTP.cookies.GetCookies(uri)["p_uin"].Value;
            //QQNum = p_uin.Remove(0, 1).TrimStart('0');
        }
Exemplo n.º 13
0
        public static string GetTranslate(string str)
        {
            string messagetosend = "原文:" + str;
            int    strLen        = str.Length;
            int    bytLeng       = System.Text.Encoding.UTF8.GetBytes(str).Length;
            string url;

            if (strLen < bytLeng)
            {
                url = "http://translate.google.cn/translate_a/single?client=t&sl=auto&tl=en&hl=zh-CN&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=1&tk=#{tk}&q=#{q}".Replace("#{q}", str).Replace("#{tk}", GetTranslate_GoogleTK(str));
            }
            else
            {
                url = "http://translate.google.cn/translate_a/single?client=t&sl=auto&tl=zh-CN&hl=zh-CN&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&srcrom=1&ssel=0&tsel=3&kc=0&tk=#{tk}&q=#{q}".Replace("#{q}", str).Replace("#{tk}", GetTranslate_GoogleTK(str));
            }

            string temp = HTTP.Get(url, "http://translate.google.cn/?sourceid=cnhp", 5000);

            string[] tmp = temp.Split('\"');
            if (tmp != null && tmp.Length > 1 && tmp[1] != null)
            {
                messagetosend = messagetosend + Environment.NewLine + "谷歌翻译:" + tmp[1];
            }

            url  = "http://fanyi.youdao.com/openapi.do?keyfrom=" + YoudaoKeyform + "&key=" + YoudaoKey + "&type=data&doctype=json&version=1.1&q=" + str;
            temp = HTTP.Get(url);
            JsonYoudaoTranslateModel dat = (JsonYoudaoTranslateModel)JsonConvert.DeserializeObject(temp, typeof(JsonYoudaoTranslateModel));

            if (dat.errorcode == 0)
            {
                if (dat.translation[0] != null)
                {
                    messagetosend = messagetosend + Environment.NewLine + "有道翻译:" + dat.translation[0];
                }
            }
            else if (dat.errorcode == 20)
            {
                messagetosend = messagetosend + Environment.NewLine + "有道翻译:不支持或文本过长";
            }
            else if (dat.errorcode == 50)
            {
                messagetosend = messagetosend + Environment.NewLine + "有道翻译:有道API密钥错误";
            }

            for (int i = 0; i < RuiRui.Badwords.Length; i++)
            {
                if (messagetosend.Contains(RuiRui.Badwords[i]))
                {
                    messagetosend = messagetosend.Replace(RuiRui.Badwords[i], "***");
                }
            }
            return(messagetosend);
        }
Exemplo n.º 14
0
        public static string GetTuLin(string msg, string QQNum = "NULL")
        {
            //string url = "http://www.tuling123.com/openapi/api";
            //string msg1 = "";
            //for (int i = 0; i < msg.Length; i++)
            //{
            //    msg1 += "&#x" + ((int)msg[i]).ToString("x").ToUpper() + ";";
            //}
            //string postdata = "{\"key\":\"#{key}\",\"info\":\"#{info}\",\"userid\":\"#{userid}\"}".Replace("#{key}", TuLinKey).Replace("#{info}", msg1).Replace("#{userid}", QQNum);
            //string temp = HTTP.Post(url, postdata);
            string         url    = "http://www.tuling123.com/openapi/api?key=#{key}&info=#{info}&userid=#{userid}".Replace("#{key}", TuLinKey).Replace("#{info}", msg).Replace("#{userid}", QQNum);
            string         temp   = HTTP.Get(url);
            JsonTuLinModel dat    = (JsonTuLinModel)JsonConvert.DeserializeObject(temp, typeof(JsonTuLinModel));
            string         MsgGet = "";

            if (dat.code == 100000)
            {
                if (dat.text.Equals(msg) || dat.text.Contains("听不懂"))
                {
                    return("");
                }
                MsgGet = dat.text;
                RuiRui.AIStudy(msg, MsgGet, "TuLin");
            }
            else if (dat.code == 302000)
            {
                for (int i = 0; i < dat.list.Count; i++)
                {
                    MsgGet += dat.list[i].source + ":" + dat.list[i].article + Environment.NewLine;
                }
            }
            else if (dat.code == 308000)
            {
                MsgGet = dat.list[0].name + ":" + dat.list[0].info;
            }
            else
            {
                return("");
            }
            for (int i = 0; i < RuiRui.Badwords.Length; i++)
            {
                if (MsgGet.Contains(RuiRui.Badwords[i]))
                {
                    return("");
                }
            }
            return(MsgGet);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 获取讨论组列表并保存
        /// </summary>
        internal static void Info_DisscussList()
        {
            string            url      = "http://s.web2.qq.com/api/get_discus_list?clientid=53999199&psessionid=#{psessionid}&vfwebqq=#{vfwebqq}&t=#{t}".Replace("#{psessionid}", psessionid).Replace("#{vfwebqq}", vfwebqq).Replace("#{t}", AID_TimeStamp());
            string            dat      = HTTP.Get(url, "http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2");
            JsonDisscussModel disscuss = (JsonDisscussModel)JsonConvert.DeserializeObject(dat, typeof(JsonDisscussModel));

            for (int i = 0; i < disscuss.result.dnamelist.Count; i++)
            {
                if (!DisscussList.ContainsKey(disscuss.result.dnamelist[i].did))
                {
                    DisscussList.Add(disscuss.result.dnamelist[i].did, new DiscussInfo());
                }
                DisscussList[disscuss.result.dnamelist[i].did].name = disscuss.result.dnamelist[i].name;
                Info_DisscussInfo(disscuss.result.dnamelist[i].did);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 根据uin获取真实QQ号
        /// </summary>
        /// <param name="uin"></param>
        /// <returns></returns>
        internal static string Info_RealQQ(string uin)
        {
            if (RealQQNum.ContainsKey(uin))
            {
                return(RealQQNum[uin]);
            }

            string url  = "http://s.web2.qq.com/api/get_friend_uin2?tuin=#{uin}&type=1&vfwebqq=#{vfwebqq}&t=#{t}".Replace("#{uin}", uin).Replace("#{vfwebqq}", vfwebqq).Replace("#{t}", AID_TimeStamp());
            string dat  = HTTP.Get(url);
            string temp = dat.Split('\"')[10].Split(',')[0].Replace(":", "");

            if (temp != "" && !RealQQNum.ContainsKey(uin))
            {
                RealQQNum.Add(uin, temp);
                return(temp);
            }
            else
            {
                return("");
            }
        }
Exemplo n.º 17
0
        public static string GetTuLin(string msg, string QQNum = "NULL")
        {
            string         url    = "http://www.tuling123.com/openapi/api?key=#{key}&info=#{info}&userid=#{userid}".Replace("#{key}", TuLinKey).Replace("#{info}", msg).Replace("#{userid}", QQNum);
            string         temp   = HTTP.Get(url);
            JsonTuLinModel dat    = (JsonTuLinModel)JsonConvert.DeserializeObject(temp, typeof(JsonTuLinModel));
            string         MsgGet = "";

            if (dat.code == 100000)
            {
                if (dat.text.Equals(msg) || dat.text.Contains("听不懂"))
                {
                    return("");
                }
                MsgGet = dat.text;
                RuiRui.AIStudy(msg, MsgGet, "TuLin");
            }
            else if (dat.code == 302000)
            {
                for (int i = 0; i < dat.list.Count; i++)
                {
                    MsgGet += dat.list[i].source + ":" + dat.list[i].article + Environment.NewLine;
                }
            }
            else if (dat.code == 308000)
            {
                MsgGet = dat.list[0].name + ":" + dat.list[0].info;
            }
            else
            {
                return("");
            }
            for (int i = 0; i < RuiRui.Badwords.Length; i++)
            {
                if (MsgGet.Contains(RuiRui.Badwords[i]))
                {
                    return("");
                }
            }
            return(MsgGet);
        }
Exemplo n.º 18
0
        public static string GetStock(string p1, string p2 = "")
        {
            string url = "";

            p1 = p1.Replace(" ", "");
            p1 = p1.Replace("\r", "");
            p1 = p1.Replace("\n", "");
            if (!p2.Equals(""))
            {
                p2 = p2.Replace(" ", "");
                p2 = p2.Replace("\r", "");
                p2 = p2.Replace("\n", "");
            }
            switch (p1)
            {
            case ("上证指数"): url = "http://hq.sinajs.cn/list=s_sh000001"; break;

            case ("深证综指"): url = "http://hq.sinajs.cn/list=s_sz399106"; break;

            case ("中小板指数"): url = "http://hq.sinajs.cn/list=s_sz399005"; break;

            case ("创业板指数"): url = "http://hq.sinajs.cn/list=s_sz399006"; break;

            case ("深证成指"): url = "http://hq.sinajs.cn/list=s_sz399001"; break;

            case ("中小板综指"): url = "http://hq.sinajs.cn/list=s_sz399101"; break;

            case ("创业板综指"): url = "http://hq.sinajs.cn/list=s_sz399102"; break;

            default:
            {
                if (p1.ToCharArray()[0] == '6')
                {
                    url = "http://hq.sinajs.cn/list=s_sh" + p1;
                }
                else if (p1.ToCharArray()[0] == '0' || p1.ToCharArray()[0] == '3')
                {
                    url = "http://hq.sinajs.cn/list=s_sz" + p1;
                }
                else if (p1.Equals("上海") || p1.Equals("沪市") || p1.Equals("上证"))
                {
                    url = "http://hq.sinajs.cn/list=s_sh" + p2;
                }
                else if (p1.Equals("深圳") || p1.Equals("深市") || p1.Equals("深证") || p1.Equals("创业板") || p1.Equals("中小板"))
                {
                    url = "http://hq.sinajs.cn/list=s_sz" + p2;
                }
                else
                {
                    return("参数错误");
                }
                break;
            }
            }
            string dat = HTTP.Get(url, "", 100000, Encoding.GetEncoding("GB2312"));

            string[] tmp = dat.Split('\"');
            tmp = tmp[1].Split(',');
            if (tmp.Length == 1)
            {
                return("参数错误");
            }
            string ans = "根据新浪财经的信息," + tmp[0] + ":现价," + tmp[1] + ";涨跌" + tmp[2] + "," + tmp[3] + "%;成交量," + tmp[4] + "手," + tmp[5] + "万元。";

            return(ans);
        }
Exemplo n.º 19
0
        public static string GetWiki(string keyword, string aim = "")
        {
            if (aim.Equals("互动百科") || aim.Equals("互动"))
            {
                string url  = "http://www.baike.com/wiki/" + keyword;
                string temp = HTTP.Get(url);
                if (temp.Contains("尚未收录"))
                {
                    return("没有找到这个词条哦~");
                }
                temp = temp.Replace("<meta content=\"", "&");
                temp = temp.Replace("\" name=\"description\">", "&");
                string[] tmp = temp.Split('&');
                if (!tmp[1].Equals(""))
                {
                    return(tmp[1] + Environment.NewLine + "详情请查看http://www.baike.com/wiki/" + HttpUtility.UrlEncode(keyword));
                }
                else
                {
                    return("");
                }
            }
            else if (aim.Equals("维基百科") || aim.Equals("维基"))
            {
                string url  = "https://zh.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exsentences=2&exintro=&explaintext=&exsectionformat=plain&exvariant=zh&titles=" + keyword;
                string temp = HTTP.Get(url);
                for (int i = 0; i < RuiRui.Badwords.Length; i++)
                {
                    if (temp.Contains(RuiRui.Badwords[i]) || keyword.Contains(RuiRui.Badwords[i]))
                    {
                        return("这个Wiki被河蟹吃掉了 QAQ");
                    }
                }
                JsonWikipediaModel     temp1 = (JsonWikipediaModel)JsonConvert.DeserializeObject(temp, typeof(JsonWikipediaModel));
                string[]               tmp   = temp1.query.pages.ToString().Split("{}".ToCharArray());
                JsonWikipediaPageModel pages = (JsonWikipediaPageModel)JsonConvert.DeserializeObject("{" + tmp[2] + "}", typeof(JsonWikipediaPageModel));

                if (pages.extract != null)
                {
                    return(pages.extract + Environment.NewLine + "详情请查看https://zh.wikipedia.org/wiki/" + HttpUtility.UrlEncode(keyword));
                }
                else
                {
                    return("没有找到这个Wiki哦~");
                }
            }
            else if (aim.Equals("百度百科") || aim.Equals("百度"))
            {
                string url  = "http://wapbaike.baidu.com/item/" + keyword;
                string temp = HTTP.Get(url);

                if (temp.Contains("您所访问的页面不存在"))
                {
                    return("没有找到这个词条哦~");
                }
                if (temp.Contains("百科名片"))
                {
                    temp = temp.Replace("&quot;", "");
                    temp = temp.Replace("&", "");
                    temp = temp.Replace("百科名片", "&");
                    string[] tmp = temp.Split('&');

                    temp = tmp[1];
                    temp = temp.Replace("<p>", "&");
                    temp = temp.Replace("</p>", "&");
                    tmp  = temp.Split('&');

                    temp = tmp[1].Replace("</a>", "");
                    temp = temp.Replace("<b>", "");
                    temp = temp.Replace("</b>", "");
                    temp = temp.Replace("<i>", "");
                    temp = temp.Replace("</i>", "");

                    temp = temp.Replace("<a", "&");
                    temp = temp.Replace("\">", "&");
                    tmp  = temp.Split('&');

                    temp = "";
                    for (int i = 0; i < tmp.Length; i += 2)
                    {
                        if ((!tmp[i].Contains("card-info")) && (!tmp[i].Contains("div class")))
                        {
                            temp += tmp[i];
                        }
                    }
                    if (!temp.Equals(""))
                    {
                        return(temp + Environment.NewLine + "详情请查看http://wapbaike.baidu.com/item/" + HttpUtility.UrlEncode(keyword));
                    }
                    else
                    {
                        return("词条 " + keyword + " 请查看http://wapbaike.baidu.com/item/" + HttpUtility.UrlEncode(keyword));
                    }
                }
                else
                {
                    return("没有找到这个词条哦~");
                }
            }
            else
            {
                string temp1 = GetWiki(keyword, "百度");
                if (temp1.Contains("查看"))
                {
                    return(temp1 + " --百度百科");
                }

                temp1 = GetWiki(keyword, "互动");
                if (temp1.Contains("查看"))
                {
                    return(temp1 + " --互动百科");
                }

                temp1 = GetWiki(keyword, "维基");
                if (temp1.Contains("查看"))
                {
                    return(temp1 + " --维基百科");
                }

                else
                {
                    return("没有找到这个词条哦~");
                }
            }
        }
Exemplo n.º 20
0
        public static string GetWeather(string city, string target)
        {
            if ((!city.Equals("呼市郊区")) && (!city.Equals("津市")) && (!city.Equals("沙市")))
            {
                city = city.Replace("省", "");
                city = city.Replace("市", "");
            }
            city = city.Replace(" ", "");
            city = city.Replace("\r", "");
            city = city.Replace("\n", "");

            target = target.Replace(" ", "");
            target = target.Replace("\r", "");
            target = target.Replace("\n", "");
            string ans = "";
            string url, temp;

            if (target.Equals("雅虎"))
            {
                url  = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20%28select%20woeid%20from%20geo.places%281%29%20where%20text=\"" + city + "\") and%20u=%22c%22&format=json";
                temp = HTTP.Get(url);
                JsonYahooWeatherModel weather = (JsonYahooWeatherModel)JsonConvert.DeserializeObject(temp, typeof(JsonYahooWeatherModel));
                if (weather.query.results == null)
                {
                    return("未查询到指定城市 " + city + " 的天气信息");
                }
                else
                {
                    ans = weather.query.results.channel.description + "(请核对城市名是否正确)";
                    for (int i = 0; i < weather.query.results.channel.item.forecast.Count; i++)
                    {
                        ans = ans + Environment.NewLine + "周" + getYahooWeak(weather.query.results.channel.item.forecast[i].day) + ":" + getYahooWeatherCode(weather.query.results.channel.item.forecast[i].code) + ",最高气温:" + weather.query.results.channel.item.forecast[i].high + "摄氏度,最低气温:" + weather.query.results.channel.item.forecast[i].low + "摄氏度";
                    }
                    return(ans);
                }
            }
            if (target.Equals("指数"))
            {
                target = "index";
            }
            else
            {
                target = "forecast";
            }
            url  = "https://ruiruiqq.hxlxz.com/weather.php?city=" + city + "&type=" + target;
            temp = HTTP.Get(url);
            if (temp.Equals("NoCity"))
            {
                return(GetWeather(city, "雅虎"));
            }

            if (target.Equals("forecast"))
            {
                JsonWeatherModel weather = (JsonWeatherModel)JsonConvert.DeserializeObject(temp, typeof(JsonWeatherModel));
                ans = "根据中国天气网于" + weather.f.f0 + "发布的气象预报," + weather.c.c3 + "的气象信息如下:" + Environment.NewLine;
                if (weather.f.f1[0].fa != null && !weather.f.f1[0].fa.Equals(""))
                {
                    ans = ans + "今天白天:" + SloveWeather(weather.f.f1[0].fa) + "," + weather.f.f1[0].fc + "摄氏度," + SloveWind(weather.f.f1[0].fe) + SloveWindPower(weather.f.f1[0].fg) + "。";
                }
                else
                {
                    ans = ans + "今天";
                }
                ans = ans + "晚上:" + SloveWeather(weather.f.f1[0].fb) + "," + weather.f.f1[0].fd + "摄氏度," + SloveWind(weather.f.f1[0].ff) + SloveWindPower(weather.f.f1[0].fh) + "。日出日落时间:" + weather.f.f1[0].fi + Environment.NewLine;
                ans = ans + "明天白天:" + SloveWeather(weather.f.f1[1].fa) + "," + weather.f.f1[1].fc + "摄氏度," + SloveWind(weather.f.f1[1].fe) + SloveWindPower(weather.f.f1[1].fg) + "。";
                ans = ans + "晚上:" + SloveWeather(weather.f.f1[1].fb) + "," + weather.f.f1[1].fd + "摄氏度," + SloveWind(weather.f.f1[1].ff) + SloveWindPower(weather.f.f1[1].fh) + "。日出日落时间:" + weather.f.f1[1].fi + Environment.NewLine;
                ans = ans + "后天白天:" + SloveWeather(weather.f.f1[2].fa) + "," + weather.f.f1[2].fc + "摄氏度," + SloveWind(weather.f.f1[2].fe) + SloveWindPower(weather.f.f1[2].fg) + "。";
                ans = ans + "晚上:" + SloveWeather(weather.f.f1[2].fb) + "," + weather.f.f1[2].fd + "摄氏度," + SloveWind(weather.f.f1[2].ff) + SloveWindPower(weather.f.f1[2].fh) + "。日出日落时间:" + weather.f.f1[2].fi;
            }
            else if (target.Equals("index"))
            {
                JsonWeatherIndexModel WeatherIndex = (JsonWeatherIndexModel)JsonConvert.DeserializeObject(temp, typeof(JsonWeatherIndexModel));
                ans = "根据中国天气网发布的气象预报," + city + "的气象信息如下:" + Environment.NewLine;
                ans = ans + WeatherIndex.i[0].i2 + ":" + WeatherIndex.i[0].i4 + ";" + WeatherIndex.i[0].i5 + Environment.NewLine;
                ans = ans + WeatherIndex.i[1].i2 + ":" + WeatherIndex.i[1].i4 + ";" + WeatherIndex.i[1].i5 + Environment.NewLine;
                ans = ans + WeatherIndex.i[2].i2 + ":" + WeatherIndex.i[2].i4 + ";" + WeatherIndex.i[2].i5;
            }
            return(ans);
        }
Exemplo n.º 21
0
 private void buttonLogIn_Click(object sender, EventArgs e)
 {
     SmartQQ.Login();
     HTTP.Get("https://ruiruiqq.hxlxz.com/infreport.php?qq=" + SmartQQ.QQNum + "&adminqq=" + RuiRui.MasterQQ);
 }