http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

12
返回列表 发新帖
楼主: 方家河农夫

[求助] httphelper get 小米网预约页面 失败

[复制链接]
发表于 2014-1-13 11:30:35 | 显示全部楼层
[C#] 纯文本查看 复制代码
  string username = "471555519@qq.com";// ldr.Cells[0].Value.ToString();
            string password = "wgy201314";//dr.Cells[2].Value.ToString();
            // string ls_yyurl=(string)parms[1];
            string Cookies = "";// (string)ldr.Cells[5].Value;
            HttpItem itemSign = new HttpItem()          //获取_sign
            {
                URL = "https://account.xiaomi.com/pass/serviceLogin",
            };
            HttpHelper http = new HttpHelper();
            HttpResult httpresult = http.GetHtml(itemSign);
            Cookies = httpresult.Cookie;
            string CallBack = System.Uri.EscapeDataString(Regex.Match(httpresult.Html, "(?<=callback = encodeURIComponent\\(\").*\"").Value.ToString().Replace("\"", ""));
            string SID = System.Uri.EscapeDataString(Regex.Match(httpresult.Html, "(?<=sid = encodeURIComponent\\(\").*\"").Value.ToString().Replace("\"", ""));
            string QS = System.Uri.EscapeDataString(Regex.Match(httpresult.Html, "(?<=qs = encodeURIComponent\\(\").*\"").Value.ToString().Replace("\"", ""));
            string SIGN = System.Uri.EscapeDataString(Regex.Match(httpresult.Html, "(?<=sign = encodeURIComponent\\(\").*\"").Value.ToString().Replace("\"", ""));
            string HIDDEN = System.Uri.EscapeDataString(Regex.Match(httpresult.Html, "(?<=hidden = encodeURIComponent\\(\").*\"").Value.ToString().Replace("\"", ""));
            string FrameSrc = System.Uri.EscapeDataString(Regex.Match(httpresult.Html, "(?<=var iframeSrc = \").*\"").Value.ToString().Replace("\"", ""));
            HttpItem item = new HttpItem()         //登陆Post
            {
                URL = "https://account.xiaomi.com/pass/serviceLoginAuth2",
                Method = "POST",
                Referer = "https://account.xiaomi.com/pass/serviceLogin",
                ContentType = "application/x-www-form-urlencoded",
                Postdata = string.Format("passToken={0}&user={1}&pwd={2}&callback={3}&sid={4}&qs={5}&hidden={6}&_sign={7}", "", username, password, CallBack, SID, QS, HIDDEN, SIGN)
            };
            HttpResult result = http.GetHtml(item);

            item = new HttpItem()
             {
                 URL = result.Header["Location"]
             };
            result = http.GetHtml(item);

            string cookie = result.Cookie;

            item = new HttpItem()
            {
                URL = result.Header["Location"],
                Referer = item.URL,
                Cookie = cookie
            };
            result = http.GetHtml(item);//成功到个人账户页面

            item = new HttpItem()
            {
                URL = result.Header["Location"],
                Referer = item.URL,
                Cookie = cookie
            };
            result = http.GetHtml(item);//成功到个人账户页面

这样才是真正的登录成功啊


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2014-7-10 14:56:23 | 显示全部楼层
学习了
回复

使用道具 举报

发表于 2014-7-10 16:21:03 | 显示全部楼层
怎么修改呢?  学习中
发表于 2015-3-31 13:54:32 | 显示全部楼层
受教了学习中……
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-11-22 14:47

© 2014-2021

快速回复 返回顶部 返回列表