苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 11845|回复: 10

[HttpHelper] 求助~页面无法抓取(未将对象引用设置到对象的实例。)

[复制链接]
发表于 2019-12-5 09:52:20 | 显示全部楼层 |阅读模式
https://www.esteelauder.com/account/index.tmpl

想抓取这个页面。

用开发助手中的万能框架测试,总是  提示  未将对象引用设置到对象的实例

请站长看下,怎么解决,谢谢


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2019-12-5 11:11:29 | 显示全部楼层
带上证书试试
 楼主| 发表于 2019-12-5 15:15:27 | 显示全部楼层
[C#] 纯文本查看 复制代码
string url = "https://www.esteelauder.com/account/index.tmpl";
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = url,//URL     必需项    
                Method = "get",//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Cookie = cookie,//字符串Cookie     可选项   
                Referer = "https://www.esteelauder.com/account/index.tmpl",//来源URL     可选项   
                Postdata = "",//Post数据     可选项GET时不需要写   
                Timeout = 100000,//连接超时时间     可选项默认为100000    
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值
                Accept = "text/html, application/xhtml+xml, */*",//    可选项有默认值
                ContentType = "text/html",//返回类型    可选项有默认值
                Allowautoredirect = false,//是否根据301跳转     可选项   
                ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数    
                ResultType = ResultType.String,
                CerPath = "D:\\333.cer"
            };
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
 楼主| 发表于 2019-12-5 15:16:16 | 显示全部楼层
[C#] 纯文本查看 复制代码
string url = "https://www.esteelauder.com/account/index.tmpl";
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = url,//URL     必需项    
                Method = "get",//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Cookie = cookie,//字符串Cookie     可选项   
                Referer = "https://www.esteelauder.com/account/index.tmpl",//来源URL     可选项   
                Postdata = "",//Post数据     可选项GET时不需要写   
                Timeout = 100000,//连接超时时间     可选项默认为100000    
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值
                Accept = "text/html, application/xhtml+xml, */*",//    可选项有默认值
                ContentType = "text/html",//返回类型    可选项有默认值
                Allowautoredirect = false,//是否根据301跳转     可选项   
                ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数    
                ResultType = ResultType.String,
                CerPath = "D:\\333.cer"
            };
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
 楼主| 发表于 2019-12-5 15:16:50 | 显示全部楼层
string url = "https://www.esteelauder.com/account/index.tmpl";
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = url,//URL     必需项   
                Method = "get",//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Cookie = cookie,//字符串Cookie     可选项   
                Referer = "https://www.esteelauder.com/account/index.tmpl",//来源URL     可选项   
                Postdata = "",//Post数据     可选项GET时不需要写   
                Timeout = 100000,//连接超时时间     可选项默认为100000   
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值
                Accept = "text/html, application/xhtml+xml, */*",//    可选项有默认值
                ContentType = "text/html",//返回类型    可选项有默认值
                Allowautoredirect = false,//是否根据301跳转     可选项   
                ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数   
                ResultType = ResultType.String,
                CerPath = "D:\\333.cer"
            };
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
 楼主| 发表于 2019-12-5 15:19:26 | 显示全部楼层
string url = "https://www.esteelauder.com/account/index.tmpl";
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = url,//URL     必需项   
                Method = "get",//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Cookie = cookie,//字符串Cookie     可选项   
                Referer = "https://www.esteelauder.com/account/index.tmpl",//来源URL     可选项   
                Postdata = "",//Post数据     可选项GET时不需要写   
                Timeout = 100000,//连接超时时间     可选项默认为100000   
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值
                Accept = "text/html, application/xhtml+xml, */*",//    可选项有默认值
                ContentType = "text/html",//返回类型    可选项有默认值
                Allowautoredirect = false,//是否根据301跳转     可选项   
                ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数   
                ResultType = ResultType.String,
                CerPath = "D:\\333.cer"
            };
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
 楼主| 发表于 2019-12-5 15:20:07 | 显示全部楼层

string url = "https://www.esteelauder.com/account/index.tmpl";
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = url,//URL     必需项   
                Method = "get",//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Cookie = cookie,//字符串Cookie     可选项   
                Referer = "https://www.esteelauder.com/account/index.tmpl",//来源URL     可选项   
                Postdata = "",//Post数据     可选项GET时不需要写   
                Timeout = 100000,//连接超时时间     可选项默认为100000   
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值
                Accept = "text/html, application/xhtml+xml, */*",//    可选项有默认值
                ContentType = "text/html",//返回类型    可选项有默认值
                Allowautoredirect = false,//是否根据301跳转     可选项   
                ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数   
                ResultType = ResultType.String,
                CerPath = "D:\\333.cer"
            };
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
 楼主| 发表于 2019-12-5 16:00:05 | 显示全部楼层

不行
发表于 2019-12-5 16:20:14 | 显示全部楼层
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
 楼主| 发表于 2019-12-5 16:52:10 | 显示全部楼层
Headers信息:
==============================================

:authority: www.esteelauder.com
:method: GET
:path: /account/index.tmpl
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding: gzip, deflate, br
accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
cache-control: max-age=0
cookie: SESSION=811955011-b95173f9a4fe62012f6e613f50d5acd39681fd30cc9a1843bda0810c25d8ec5a; LOCALE=en_US; ngglobal=dcb4165612812966; elist15=1; PSN=%7B%7D; __ssid=3ccdbdf4285d06911b217007e7d80df; LPVID=Y5NWU0NzNmZjM0NDI1MmQ5; ngsession=c29ce55f30852895; has_js=1; client.isMobile=0; FeedTrayCookie=1; Auser=0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0-null; s_sess=%20p17%3Dnohome%3B%20advancednightrepair%3Dnoadvancednightrepair%3B%20bronzegoddess%3Dnobronzegoddess%3B%20cleardifference%3Dnocleardifference%3B%20purecolorenvy%3Dnopurecolorenvy%3B; _ga=GA1.3.1384614951.1575510627; _gid=GA1.3.1501369605.1575510627; cto_lwid=d24e6f24-c4e0-4069-9038-998ae53e8bd0; xyz_cr_643_et_112==&cr=643&et=112&ap=; _gcl_au=1.1.1869555999.1575510631; _scid=1b5529c5-9ce7-478a-8c4b-6d0a358f15b9; AMCVS_3C155B5B54E781000A4C98A2%40AdobeOrg=1; s_cc=true; __qca=P0-1046815031-1575510629048; _fbp=fb.1.1575510633323.2098027227; __bron_bav=2019/12/5 上午9:50:33; __bron_bas=5169fbc0-22c5-409a-84c6-61ff5d3565b2; yieldify_stc=1; yieldify_st=1; yieldify_sale_ts=1575510634240; yieldify_visit=1; yieldify_iv=1; _y2=1%3AeyJjIjp7IjEyMzMxOSI6LTE0NzM5ODQwMDAsIm8iOi0xNDczOTg0MDAwfX0%3D%3ALTE0NzEzNjMxNjg%3D%3A2; __bron_bae=c542e7536fd60f2907c44889c0b6545065a92660bf1ea37b5510a75b1b7be5096d6e1acd07c4346db5dd7bbcc87e0771282951afd118a1cae405025faf8edcab; __btr_em=MzYwNTkyMDkzNkBxcS5jb20%3D; AKA_A2=A; ak_bmsc=E37253C1E85404568EFD8866A235F43743942FD55C63000081BCE85DB991260D~plLvqQngEJA+DbErsBGrxQ9dCqcCL4+mKVnYtv3l44D/4MbLMnOa/IGDH3ip8Z8NniR7W9C1yPiWj7ZDdjMMxEDwVTTmiWFhw54J7161Wb7GSHXWZPYQjnV5mQQpGmucV0wbRj64hVskJsD92TGzNiJt0TjJwdmpgxMfRIxDQhqVVoA96/kWkDDlLdMu51+qA6pW/sD9TwdhZJJRokJDD5TAJBIHJrNKd2rmrJxZbbKPU=; AMCV_3C155B5B54E781000A4C98A2%40AdobeOrg=1406116232%7CMCIDTS%7C18236%7CMCMID%7C53506050442716723497692585084612478288%7CMCOPTOUT-1575540928s%7CNONE%7CMCAID%7CNONE%7CMCAAMLH-1576138528%7C11%7CMCAAMB-1576138528%7Cj8Odv6LonN4r3an7LhD3WZrU1bUpAkFkkiY1ncBR96t2PTI%7CMCSYNCSOP%7C411-18243%7CvVersion%7C2.5.0; _y1sp_ses.ab92=*; yieldify_location=%257B%2522country%2522%253A%2522China%2522%252C%2522region%2522%253A%2522Anhui%2522%252C%2522city%2522%253A%2522Hefei%2522%257D; LPSID-48719195=rj3z5MURTXyUE6n4sbaZSA; persistent_user_cookie=%7B%22first_time%22%3A0%2C%22first_name%22%3Anull%2C%22pc_email_optin%22%3A%220%22%2C%22email%22%3Anull%2C%22is_loyalty_member%22%3A%220%22%2C%22points%22%3Anull%2C%22loyalty_level%22%3A%220%22%2C%22loyalty_level_name%22%3Anull%2C%22points_to_next_level%22%3A%220%22%2C%22next_level%22%3A%221%22%2C%22next_level_name%22%3A%22Be%2BExcited%22%7D; OptanonConsent=isIABGlobal=false&datestamp=Thu+Dec+05+2019+16%3A21%3A50+GMT%2B0800+(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)&version=5.5.0&landingPath=https%3A%2F%2Fwww.esteelauder.com%2Faccount%2Findex.tmpl&groups=1%3A1%2C2%3A1%2C3%3A1%2C4%3A1%2C0_211436%3A1%2C0_217002%3A1%2C0_211434%3A1%2C0_227874%3A1%2C0_227876%3A1%2C0_211438%3A1%2C0_211428%3A1%2C0_211426%3A1%2C0_211432%3A1%2C0_211430%3A1%2C0_211437%3A1%2C0_211435%3A1%2C0_227875%3A1%2C0_211439%3A1%2C0_227877%3A1%2C0_211429%3A1%2C0_211427%3A1%2C0_211433%3A1%2C0_211431%3A1%2C0_217001%3A1%2C0_211425%3A1%2C8%3A1; elist15_expire=1575534110613; utag_main=v_id:016ed3c04fa30013ea0eb44f143703081002e07900bd0$_sn:3$_ss:0$_st:1575535917109$vapi_domain:esteelauder.com$ses_id:1575533728585%3Bexp-session$_pn:2%3Bexp-session; __bron_bar=[{"productId":null,"timeStamp":1575534117295}]; csrftoken=572bdbdb3f6f9b5b17425a071454e18e99e003ef%2C93795f38acb7f05e3603a1ab41d462fd272cd903%2C1575534118; _y1sp_id.ab92=ee3b974e-2308-48e5-96ad-69485ac07f81.1575510634.3.1575534119.1575516402.c1852b1b-49b9-4fa5-bc04-1d68d5bc00da; _gali=signin; bm_sv=66F34E9612E911FB3350CA45AB13AC03~AW2gC8Y47psBapyu9zAewLfbvC9hqkByOfD7U6/A5wEyW6BvxdvHeLBfgwLwAeq9HpLT4mYIy0MMaK6Oy5QLHhGhQFBpbbZh76ieB/o5LYqVMHX6Oy2IGpAZaK6ikL/Z9geuP6hZGABNJjBwgeJX6TMmfEzA/7Bk/I44o0ONhEA=; yieldify_ujt=15367; _yi=1%3AeyJsaSI6bnVsbCwic2UiOnsiYyI6MywibGEiOjE1NzU1MzQ4MjQ4MzQsInAiOjIsInNjIjoxMDA1fSwidSI6eyJpZCI6IjE0ZjJkNjUxLWQyNjItNGJlNS1hZTI3LTJjODNjM2MyNDdiNSIsImZsIjoiMCJ9fQ%3D%3D%3ALTE5NjU3ODQwMA%3D%3D%3A2; RT="sl=3&ss=1575533702790&tt=60203&obo=0&sh=1575534114141%3D3%3A0%3A60203%2C1575534062286%3D2%3A0%3A52112%2C1575533725268%3D1%3A0%3A22467&dm=esteelauder.com&si=aec1f507-8931-473f-b70f-fe6f6570e45f&bcn=%2F%2F173e2514.akstat.io%2F&r=https%3A%2F%2Fwww.esteelauder.com%2Faccount%2Findex.tmpl&ul=1575534824813"
sec-fetch-mode: navigate
sec-fetch-site: none
sec-fetch-user: ?1
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.56 Safari/537.36 Edg/79.0.309.40
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-12-25 16:11

© 2014-2021

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