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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 11038|回复: 6

[咨询站长] 求助关于猎聘网的登录问题

[复制链接]
发表于 2016-1-27 23:14:06 | 显示全部楼层 |阅读模式
我把cookie该有的都设置上了,该POST的数据也都设置上了。后来不行,直接写死也试了。
一直提示:"{\"status\":\"4\",\"message\":\"缺少当前访问者id\",\"msg\":\"缺少当前访问者id\",\"code\":\"4\",\"flag\":0}"
实在找不着为什么了,谁帮忙抓个包分析一下啊,谢谢!

如下图所示:
lp.JPG


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2016-1-28 14:59:05 | 显示全部楼层
本帖最后由 wellhi1 于 2016-1-28 15:08 编辑

注册了一个测试账号,求帮忙。

用户名:jianjinke@163.com
密码:jianjinke

剪辑.jpg
发表于 2016-1-28 21:57:26 | 显示全部楼层
wellhi1 发表于 2016-1-28 14:59
注册了一个测试账号,求帮忙。

用户名:

function gr_user_id() {
    var e;
    return e= (new Date).getTime(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,
    function(t) {
        var r,n;
        return r= (e+16*Math.random())%16|0,e=Math.floor(e/16),n="x"===t?r:3&r|8,n.toString(16)
    })
}
估计与这个Cookie有关,加上试试看。
发表于 2016-1-29 17:03:01 | 显示全部楼层
不用字符串Cookie,试下CookieContainer我这里测试轻松登录





 楼主| 发表于 2016-1-30 12:03:26 | 显示全部楼层
mmgx2013 发表于 2016-1-29 17:03
不用字符串Cookie,试下CookieContainer我这里测试轻松登录

能分享一下你的登录代码吗?
我试了三种方法都不行。
[C#] 纯文本查看 复制代码
        public void LiePin_Login3()
        {


            try
            {
                string url = "";
                HttpItem item = new HttpItem();
                http = new HttpHelper();
                HttpResult httpresult;

                CookieCollection cookieCollection = new CookieCollection();


                url = "http://statistic.liepin.com/statVisit.do?site=1&userId=0&userKind=0&url=http%3A%2F%2Fwww.liepin.com%2F&resolution=1280x800&h=11&m=29&s=57&cookie=1&ref=&puuid=14541245912813477200659&stay_time=6000&rand=0.9467251336221421";

                item = new HttpItem()
                {
                    URL = url,
                    Method = "GET",
                    Referer = "http://www.liepin.com/",
                    UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
                    CookieCollection = cookieCollection,
                    ResultCookieType = ResultCookieType.CookieCollection

                };
                httpresult = http.GetHtml(item);
                cookieCollection = httpresult.CookieCollection;


                url = "http://www.liepin.com/image/randomcode/";

                item = new HttpItem()
                {
                    URL = url,
                    Method = "GET",
                    Referer = "http://www.liepin.com/",
                    UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
                    CookieCollection = cookieCollection,
                    ResultCookieType = ResultCookieType.CookieCollection

                };
                httpresult = http.GetHtml(item);
                cookieCollection = httpresult.CookieCollection;
                Cookie cookie = new Cookie("_fecdn_", "1", "/", ".liepin.com");

                cookieCollection.Add(cookie);
                cookie = new Cookie("__session_seq", "2", "/", ".liepin.com");
                cookieCollection.Add(cookie);

                cookie = new Cookie("_mscid", "00000000", "/", ".liepin.com");
                cookieCollection.Add(cookie);
                cookie = new Cookie("_ltu", "%7B%22level%22%3A3%2C%22goldcard%22%3Afalse%2C%22id%22%3A%2227175691%22%2C%22v%22%3A%221.1%22%7D", "/", ".liepin.com");
                cookieCollection.Add(cookie);
                cookie = new Cookie("gr_user_id", "7b081cd2-1cae-45e2-b84b-dbb5c4ff26d0", "/", ".liepin.com");
                cookieCollection.Add(cookie);
                cookie = new Cookie("gr_session_id", "c3caabdc-4285-47ee-b090-fd394ab1092e", "/", ".liepin.com");
                cookieCollection.Add(cookie);


                url = "http://www.liepin.com/user/ajaxlogin.json";
                string postData = "user_kind=0&isMd5=1&layer_from=wwwindex_top_cover_login_userc&user_login=jianjinke%40163.com&user_pwd=4b122bcfedf844086658d4357368e5ed&chk_remember_pwd=on";
                item = new HttpItem()
                {
                    URL = url,
                    Method = "POST",
                    ContentType = "application/x-www-form-urlencoded",
                    Accept = "application/json, text/javascript, */*; q=0.01",
                    Postdata = postData,
                    Referer = "http://www.liepin.com/",
                    UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
                    CookieCollection = cookieCollection,
                    ResultCookieType = ResultCookieType.CookieCollection

                };

                httpresult = http.GetHtml(item);
                cookieCollection = httpresult.CookieCollection;

            }
            catch (Exception ex)
            {
                TraceLog.PrintLn(ex.Message);
            }
        }

        public void LiePin_Login2()
        {


            try
            {
                string url = "";
                HttpItem item = new HttpItem();
                http = new HttpHelper();
                HttpResult httpresult;

                CookieCollection cookieCollection = new CookieCollection();


                url = "http://statistic.liepin.com/statVisit.do?site=1&userId=0&userKind=0&url=http%3A%2F%2Fwww.liepin.com%2F&resolution=1280x800&h=11&m=29&s=57&cookie=1&ref=&puuid=14541245912813477200659&stay_time=6000&rand=0.9467251336221421";

                item = new HttpItem()
                {
                    URL = url,
                    Method = "GET",
                    Referer = "http://www.liepin.com/",
                    UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
                    CookieCollection = cookieCollection,
                    ResultCookieType = ResultCookieType.CookieCollection

                };
                httpresult = http.GetHtml(item);
                cookieCollection  = httpresult.CookieCollection ;


                url = "http://www.liepin.com/image/randomcode/";

                item = new HttpItem()
                {
                    URL = url,
                    Method = "GET",
                    Referer = "http://www.liepin.com/",
                    UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
                    CookieCollection = cookieCollection,
                    ResultCookieType = ResultCookieType.CookieCollection

                };
                httpresult = http.GetHtml(item);
                cookieCollection = httpresult.CookieCollection;

                url = "http://www.liepin.com/user/ajaxlogin.json";
                string postData = "user_kind=0&isMd5=1&layer_from=wwwindex_top_cover_login_userc&user_login=jianjinke%40163.com&user_pwd=4b122bcfedf844086658d4357368e5ed&chk_remember_pwd=on";
                item = new HttpItem()
                {
                    URL = url,
                    Method = "POST",
                    ContentType = "application/x-www-form-urlencoded",
                    Accept = "application/json, text/javascript, */*; q=0.01",
                    Postdata = postData,
                    Referer = "http://www.liepin.com/",
                    UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
                    CookieCollection = cookieCollection,
                    ResultCookieType = ResultCookieType.CookieCollection

                };

                httpresult = http.GetHtml(item);
                cookieCollection = httpresult.CookieCollection;
                
            }
            catch (Exception ex)
            {
                TraceLog.PrintLn (ex.Message);
            }
        }
        public void LiePin_Login1()
        {


            try
            {
                string url = "";
                HttpItem item = new HttpItem();
                http = new HttpHelper();
                HttpResult httpresult;

                CookieCollection cookieCollection = new CookieCollection();
                Cookie cookie = new Cookie("__tlog", PubFun.getTimeTicks1() + ".57%7C00000000%7C00000000%7C00000000%7C00000000", "/", ".liepin.com");

                cookieCollection.Add(cookie);
                cookie = new Cookie("__session_seq", "2", "/", ".liepin.com");
                cookieCollection.Add(cookie);

                cookie = new Cookie("_mscid", "00000000", "/", ".liepin.com");
                cookieCollection.Add(cookie);
                cookie = new Cookie("_ltu", "%7B%22level%22%3A3%2C%22goldcard%22%3Afalse%2C%22id%22%3A%2227175691%22%2C%22v%22%3A%221.1%22%7D", "/", ".liepin.com");
                cookieCollection.Add(cookie);

                url = "http://www.liepin.com/webUser/login4c.json";
                string postData = "user_login=jianjinke%40163.com&user_pwd=4b122bcfedf844086658d4357368e5ed&chk_remember_pwd=on";
                item = new HttpItem()
                {
                    URL = url,
                    Method = "POST",
                    ContentType = "application/x-www-form-urlencoded",
                    Accept = "application/json, text/javascript, */*; q=0.01",
                    Postdata = postData,
                    Referer = "http://www.liepin.com/user/login/?user_login=",
                    UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
                    CookieCollection = cookieCollection,
                    ResultCookieType = ResultCookieType.CookieCollection

                };

                httpresult = http.GetHtml(item);
                Cookies = httpresult.Cookie;
                
            }
            catch (Exception ex)
            {
                TraceLog.PrintLn (ex.Message );
            }
        }
发表于 2016-2-15 15:09:19 | 显示全部楼层
这个问题我也遇到了,搞了很久,最后发现是要在请求头里加上
X-Requested-With:XMLHttpRequest
如此简单,真是坑爹,还以为猎聘网有什么牛逼的防机器人技术呢!
 楼主| 发表于 2016-2-25 10:02:32 | 显示全部楼层
fuguanges 发表于 2016-2-15 15:09
这个问题我也遇到了,搞了很久,最后发现是要在请求头里加上
X-Requested-With:XMLHttpRequest
如此简单 ...

果真是,非常感谢!
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-11-23 18:44

© 2014-2021

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