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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 8035|回复: 4

[其他] 登陆京东提示刷新重试

[复制链接]
发表于 2015-5-7 22:29:23 | 显示全部楼层 |阅读模式
返回的提示是这样的:
({"username":"\u8bf7\u5237\u65b0\u9875\u9762\u540e\u91cd\u65b0\u63d0\u4ea4"})
({"username":"请刷新页面后重新提交"})
多人判断是cookie错了,
这个cookie该怎么带呢?类型错了吗
源码的下载地址
http://www.sufeinet.com/thread-12101-1-1.html




代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CsharpHttpHelper;
using System.Net;
using CsharpHttpHelper.Enum;
using System.Text.RegularExpressions;
using System.Web;
namespace 京东测试
{
    public partial class Form1 : Form
    {
        HttpHelper http = new HttpHelper();
        HttpItem item = null;

        HttpResult result = null;

        string Cookie = "";
        string retCode = "";
        string uuid;
        string param;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            if (txtUser.Text == "" || txtPass.Text == "") return;         
            var r = new Random().NextDouble(); //随机数字
            //创建Httphelper参数对象
            item = new HttpItem()
            {
                URL = "https://passport.jd.com/uc/login?ltype=logout",//URL     必需项   
                Method = "get",//URL     可选项 默认为Get   
                ContentType = "text/html",//返回类型    可选项有默认值                  
            };
            //请求的返回值对象
            result = http.GetHtml(item);
            //获取请请求的Html
            string html = result.Html;
            //获取请求的Cookie           
            Cookie = result.Cookie; //得到cookie
            result = http.GetHtml(item);           
            retCode = result.Html;
            uuid = HttpHelper.GetBetweenHtml(retCode, "uuid\" value=\"", "\"");
            param = getstring(retCode);


            var ReturnUrl = "http%3A%2F%2Fvip.jd.com%2F";
            var version = "2015";
            item = new HttpItem()
             {
                 URL = "https://passport.jd.com/uc/loginService?uuid="+ uuid+"&ReturnUrl="+ReturnUrl+"&r="+r+"&version="+ version,                  
                 Method = "POST",
                 //Referer = "https://passport.jd.com/uc/login?ltype=logout",
                 Referer = "http://passport.jd.com/new/login.aspx?ReturnUrl=http%3A%2F%2Fvip.jd.com%2F",
                 Accept = "*/*",
                 Postdata = "uuid=" + uuid + "&loginname=" + txtUser.Text + "&nloginpwd=" + txtPass.Text + "&loginpwd=" + txtPass.Text + "&machineNet=&machineCpu=&machineDisk=&authcode=&" + param,
                 Cookie = Cookie, //在请求页面使用这个值     
                 Allowautoredirect=true,
                 ContentType  = "application/x-www-form-urlencoded",
                  Timeout = 200000,
                 ReadWriteTimeout = 100000

             };

            item.Header.Add("x-requested-with", "XMLHttpRequest");
            item.Header.Add("Accept-Encoding", "gzip, deflate");

            result = http.GetHtml(item);
            Cookie += result.Cookie;
            retCode = result.Html;
            if (retCode.Contains("\\u9a8c\\u8bc1\\u7801\\u4e0d\\u6b63\\u786e\\u6216\\u9a8c\\u8bc1\\u7801\\u5df2\\u8fc7\\u671f"))
            {
                MessageBox.Show("验证码不正确或验证码已过期");

            }
            else if (retCode.Contains("({\"success\":\"http://www.jd.com"))
                MessageBox.Show("登录成功!");
            else if (retCode.Contains("\\u8bf7\\u5237\\u65b0\\u9875\\u9762\\u540e\\u91cd\\u65b0\\u63d0\\u4ea4"))
                MessageBox.Show("请刷新页面后重新提交!");都返回这个值
            else
                MessageBox.Show("未知错误!");

        }






1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2015-5-7 22:51:32 | 显示全部楼层
_t=xwj5DocpvZWC9w7Z3WUphOSpgd2rDj1T/MR/I75Cd3M=; Path=/;,alc=9jTwNFOyJkztqAWV5KauHA==; Path=/; HttpOnly cookie的样式,精简的cookie也不行,
发表于 2015-5-8 23:47:39 | 显示全部楼层
%]~{D8YT4%KM@IFOEKZD2@L.png

<input type="hidden" name="LOfYeemmIq" value="HfTKd" />


LOfYeemmIq=HfTKd //这俩参数都会变的 你注意下把!加上他就OK了
发表于 2015-5-9 15:24:19 | 显示全部楼层
你这抓的包和我不一样啊,不过楼上已经给出了你缺少的数据
发表于 2015-5-15 15:47:51 | 显示全部楼层
DDDDDDDDDDDDDDD
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-4-29 03:29

© 2014-2021

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