用的request是superagent 然后下面是代码。
-
request
-
.post(`http://www.lagou.com/jobs/positionAjax.json?px=new&needAddtionalResult=false&city=${city}`)
-
.type('application/x-www-form-urlencoded')
-
.set({
-
'API-Key': 'foobar',
-
'Accept': 'application/json, text/javascript, */*; q=0.01',
-
'Accept-Encoding': 'gzip, deflate, br',
-
'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6',
-
'Cache-Control': 'no-cache',
-
'Connection': 'keep-alive',
-
'Origin': 'http://evil.com/',
-
'Pragma': 'no-cache',
-
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36',
-
'X-Anit-Forge-Code': '0',
-
'X-Anit-Forge-Token': 'None',
-
'X-Requested-With': 'XMLHttpRequest',
-
})
-
.send({ kd: position.name, pn: 1, first:true })
-
.proxy(proxy)
-
.timeout(3000);
-
大神帮帮我吧。
-
这是返回的值。。
Response { domain: null, _events: {}, _eventsCount: 0, _maxListeners: undefined, res: IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [Object], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: true, endEmitted: true, reading: false, sync: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, defaultEncoding: ‘utf8’, ranOut: false, awaitDrain: 0, readingMore: false, decoder: [Object], encoding: ‘utf8’ }, readable: false, domain: null, _events: { end: [Object], data: [Object], error: [Object], close: [Function: bound emit] }, _eventsCount: 4, _maxListeners: undefined, socket: Socket { connecting: false, _hadError: false, _handle: [Object], _parent: null, _host: null, _readableState: [Object], readable: true, domain: null, _events: [Object], _eventsCount: 5, _maxListeners: undefined, _writableState: [Object], writable: true, allowHalfOpen: false, destroyed: false, _bytesDispatched: 686, _sockname: null, _pendingData: null, _pendingEncoding: ‘’, server: null, _server: null, parser: null, _httpMessage: [Object], read: [Function], _consuming: true }, connection: Socket { connecting: false, _hadError: false, _handle: [Object], _parent: null, _host: null, _readableState: [Object], readable: true, domain: null, _events: [Object], _eventsCount: 5, _maxListeners: undefined, _writableState: [Object], writable: true, allowHalfOpen: false, destroyed: false, _bytesDispatched: 686, _sockname: null, _pendingData: null, _pendingEncoding: ‘’, server: null, _server: null, parser: null, _httpMessage: [Object], read: [Function], _consuming: true }, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: ‘1.1’, complete: true, headers: { server: ‘nfs’, date: ‘Wed, 05 Apr 2017 08:31:32 GMT’, ‘content-type’: ‘text/html’, ‘content-length’: ‘4093’, ‘last-modified’: ‘Tue, 27 Dec 2016 02:38:07 GMT’, connection: ‘keep-alive’, etag: ‘“5861d40f-ffd”’, ‘accept-ranges’: ‘bytes’ }, rawHeaders: [ ‘Server’, ‘nfs’, ‘Date’, ‘Wed, 05 Apr 2017 08:31:32 GMT’, ‘Content-Type’, ‘text/html’, ‘Content-Length’, ‘4093’, ‘Last-Modified’, ‘Tue, 27 Dec 2016 02:38:07 GMT’, ‘Connection’, ‘keep-alive’, ‘ETag’, ’“5861d40f-ffd”’, ‘Accept-Ranges’, ‘bytes’ ], trailers: {}, rawTrailers: [], upgrade: false, url: ‘’, method: null, statusCode: 200, statusMessage: ‘OK’, client: Socket { connecting: false, _hadError: false, _handle: [Object], _parent: null, _host: null, _readableState: [Object], readable: true, domain: null, _events: [Object], _eventsCount: 5, _maxListeners: undefined, _writableState: [Object], writable: true, allowHalfOpen: false, destroyed: false, _bytesDispatched: 686, _sockname: null, _pendingData: null, _pendingEncoding: ‘’, server: null, _server: null, parser: null, _httpMessage: [Object], read: [Function], _consuming: true }, _consuming: true, _dumped: false, req: ClientRequest { domain: null, _events: [Object], _eventsCount: 3, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, upgrading: false, chunkedEncoding: false, shouldKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: [Object], _contentLength: 0, _hasBody: true, _trailer: ‘’, finished: true, _headerSent: true, socket: [Object], connection: [Object], _header: ‘GET http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22 HTTP/1.1\r\nHost: forbidden.lagou.com:80\r\naccept-encoding: gzip, deflate, br\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36\r\napi-key: foobar\r\naccept: application/json, text/javascript, /; q=0.01\r\naccept-language: zh-CN,zh;q=0.8,en;q=0.6\r\ncache-control: no-cache\r\nconnection: keep-alive\r\norigin: http://evil.com/\r\npragma: no-cache\r\nreferer: https://www.lagou.com/jobs/list_node?city=杭州&cl=false&fromSearch=true&labelWords=&suginput=\r\nx-anit-forge-code: 0\r\nx-anit-forge-token: None\r\nx-requested-with: XMLHttpRequest\r\n\r\n’, _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, timeout: undefined, method: ‘GET’, path: ‘http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22’, _ended: true, res: [Circular], aborted: undefined, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, _options: null }, text: ‘<!DOCTYPE html>\n<html lang=“en”>\n<head>\n\t<meta charset=“UTF-8”>\n\t<title>Document</title>\n\t<style>\n\t\t* {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\tbody {\n\t\t\tfont-family: “Hiragino Sans GB”, “Microsoft Yahei”, “SimSun”, Arial, “Helvetica Neue”, Helvetica;\n\t\t\tbackground: #f8f9fc;\t\t\t\n\t\t}\n\t\t.i_error {\n\t\t\tposition: relative;\n\t\t\t/width: 654px;/\n\t\t\twidth: 34.0625%;\n\t\t\t/height: 467px;/\n\t\t\tmargin: 67px auto 0;\t\n\t\t\t/background: url(./blocked_404.png) 0 0 no-repeat;/\n\t\t}\n\t\t.i_logo {\n\t\t\tposition: absolute;\n\t\t\t/top: 116px;/\n\t\t\ttop: 24.8394%;\n\t\t\t/left: 68px;/\n\t\t\tleft: 9.785933%;\n\t\t\t/width: 110px;/\n\t\t\twidth: 16.819572%;\n\t\t\t/height: 41px;/\n\t\t\t/background: url(./lagou_logo.png) 0 0 no-repeat;/\n\t\t}\n\t\t.tip {\n\t\t\tmargin-top: 49px;\n\t\t\tfont-size: q8px;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t\tcolor: #333;\n\t\t}\n\t\t.msg {\n\t\t\tmargin-top: 15px;\n\t\t\ttext-align: center;\n\t\t\tfont-size: 16px;\n\t\t\tline-height: 16px;\n\t\t\tcolor: #777;\n\t\t}\n\t\t.qq {\n\t\t\tmargin-top: 15px;\n\t\t\tfont-size: 18px;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.qq a {\n\t\t\tdisplay: inline-block;\n\t\t\twidth: 100px;\n\t\t\theight: 30px;\n\t\t\tborder-radius: 2px;\n\t\t\tline-height: 30px;\n\t\t\ttext-decoration: none;\n\t\t\tcolor: #fff;\n\t\t\tbackground: #00b38a;\n\t\t}\n\t</style>\n\t<script type=“text/javascript” src=“https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js”></script>\n</head>\n<body>\n\t<div class=“i_error”>\n\t\t<img src="./blocked_404.png" alt=“404” width=“100%”>\n\t\t<div class=“i_logo”><img src="./lagou_logo.png" alt=“logo” width=“100%”></div>\n\t</div>\t\n\t<div class=“tip”>近期我们监控到您所用的IP地址出现异常,您的IP地址是:<span id=“ip”></span></div>\n\t<p class=“tip”>临时将此IP地址进行安全保护,但可能导致您无法正常登陆。</p>\n\t<p class=“msg”>如有问题,请发送邮件至gogo@lagou.com。带来不便,敬请谅解,谢谢!</p>\n\n\t<p class=“qq”><a id=“onlineService” href=“javascript:void(0);”>在线交流</a></p>\n\t\n\t<script type=“text/javascript”>\n\t // jQuery.ajax({\n\t // url: ‘http://wpa.b.qq.com/cgi/wpa.php’,\n\t // dataType: ‘script’,\n\t // cache: true\n\t // }).done(function() {\n\t // BizQQWPA.addCustom({aty: ‘0’, a: ‘0’, nameAccount: 800056379, selector: ‘onlineService’});\n\t // });\n\t function getQueryString(name){\n\t\t\t var reg = new RegExp("(^|&)"+ name +"=([^&])(&|$)");\n\t\t\t var r = window.location.search.substr(1).match(reg);\n\t\t\t if(r!=null){\n\t\t\t \treturn unescape(r[2]); \n\t\t\t }\n\t\t\t return “”;\n\t\t\t}\n\t\t\tdocument.getElementById(“ip”).innerHTML = encodeURI(getQueryString(“ip”));\n\t</script>\n\t<script >\n\t$(document).ready(function () {\n var selector = ‘#webchat7moor’;\n if ($(selector).length) {\n return;\n }\n var jqIframe = $(’<iframe>’, {\n id: selector.slice(1),\n src: ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’) + ‘/third-parties/webchat7moor/main_59be2f6.html’,\n style: ‘margin:0;’\n + ‘padding:0;’\n + ‘width:320px;’\n + ‘height:500px;’\n + ‘border-width:0;’\n + ‘border-radius: 3px;’\n + ‘transition: height 0.5s ease-out;’\n + ‘z-index:-99999;’\n + ‘display: none;’\n + ‘bottom:0;’\n + ‘right:0;’\n + ‘position:fixed;’\n });\n $(document.body).append(jqIframe);\n var child = jqIframe[0].contentWindow;\n var target = window.location.protocol + ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’);\n $(’#onlineService, #feedback-icon’).on(‘click’, function (e) {\n jqIframe.css(‘z-index’, 99999).show();\n child.postMessage(’{“code”:1,“message”:“open webchat plugin”}’, target);\n });\n $(window).on(‘message’, function (e) {\n var origin = e.origin || e.originalEvent.origin;\n if (origin.indexOf(target) !== 0) {\n return;\n }\n var data = e.data || e.originalEvent.data;\n if (data.code === 2 && typeof data.css !== ‘undefined’) {\n jqIframe.css(data.css);\n } else {\n jqIframe.css(‘z-index’, -99999).hide();\n }\n });\n});\n\t</script>\n</body>\n</html>\n’, read: [Function] }, request: Request { domain: null, _events: {}, _eventsCount: 0, _maxListeners: undefined, _agent: ProxyAgent { domain: null, _events: {}, _eventsCount: 0, _maxListeners: undefined, callback: [Function: connect], proxy: [Object], proxyUri: ‘http://124.88.67.22:80’, proxyFn: [Function: httpOrHttpsProxy] }, method: ‘GET’, url: [Getter/Setter], _header: { ‘user-agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36’, ‘accept-encoding’: ‘gzip, deflate, br’, ‘api-key’: ‘foobar’, accept: ‘application/json, text/javascript, /; q=0.01’, ‘accept-language’: ‘zh-CN,zh;q=0.8,en;q=0.6’, ‘cache-control’: ‘no-cache’, connection: ‘keep-alive’, origin: ‘http://evil.com/’, pragma: ‘no-cache’, referer: ‘https://www.lagou.com/jobs/list_node?city=杭州&cl=false&fromSearch=true&labelWords=&suginput=’, ‘x-anit-forge-code’: ‘0’, ‘x-anit-forge-token’: ‘None’, ‘x-requested-with’: ‘XMLHttpRequest’ }, header: { ‘User-Agent’: ‘node-superagent/3.5.2’, ‘accept-encoding’: ‘gzip, deflate, br’, ‘user-agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36’, ‘api-key’: ‘foobar’, accept: ‘application/json, text/javascript, /; q=0.01’, ‘accept-language’: ‘zh-CN,zh;q=0.8,en;q=0.6’, ‘cache-control’: ‘no-cache’, connection: ‘keep-alive’, origin: ‘http://evil.com/’, pragma: ‘no-cache’, referer: ‘https://www.lagou.com/jobs/list_node?city=杭州&cl=false&fromSearch=true&labelWords=&suginput=’, ‘x-anit-forge-code’: ‘0’, ‘x-anit-forge-token’: ‘None’, ‘x-requested-with’: ‘XMLHttpRequest’ }, writable: true, _redirects: 1, _maxRedirects: 5, cookies: ‘’, qs: {}, qsRaw: [ ‘ip=124.88.67.22’ ], _redirectList: [ ‘http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22’ ], _streamRequest: false, _data: null, _url: ‘http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22’, _proxyUri: ‘http://124.88.67.22:80’, _timeout: 3000, _responseTimeout: 0, protocol: ‘http:’, host: ‘forbidden.lagou.com’, _endCalled: true, _callback: [Function], _fullfilledPromise: Promise { [Object] }, res: IncomingMessage { _readableState: [Object], readable: false, domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, socket: [Object], connection: [Object], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: ‘1.1’, complete: true, headers: [Object], rawHeaders: [Object], trailers: {}, rawTrailers: [], upgrade: false, url: ‘’, method: null, statusCode: 200, statusMessage: ‘OK’, client: [Object], _consuming: true, _dumped: false, req: [Object], text: '<!DOCTYPE html>\n<html lang=“en”>\n<head>\n\t<meta charset=“UTF-8”>\n\t<title>Document</title>\n\t<style>\n\t\t {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\tbody {\n\t\t\tfont-family: “Hiragino Sans GB”, “Microsoft Yahei”, “SimSun”, Arial, “Helvetica Neue”, Helvetica;\n\t\t\tbackground: #f8f9fc;\t\t\t\n\t\t}\n\t\t.i_error {\n\t\t\tposition: relative;\n\t\t\t/width: 654px;/\n\t\t\twidth: 34.0625%;\n\t\t\t/height: 467px;/\n\t\t\tmargin: 67px auto 0;\t\n\t\t\t/background: url(./blocked_404.png) 0 0 no-repeat;/\n\t\t}\n\t\t.i_logo {\n\t\t\tposition: absolute;\n\t\t\t/top: 116px;/\n\t\t\ttop: 24.8394%;\n\t\t\t/left: 68px;/\n\t\t\tleft: 9.785933%;\n\t\t\t/width: 110px;/\n\t\t\twidth: 16.819572%;\n\t\t\t/height: 41px;/\n\t\t\t/background: url(./lagou_logo.png) 0 0 no-repeat;/\n\t\t}\n\t\t.tip {\n\t\t\tmargin-top: 49px;\n\t\t\tfont-size: q8px;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t\tcolor: #333;\n\t\t}\n\t\t.msg {\n\t\t\tmargin-top: 15px;\n\t\t\ttext-align: center;\n\t\t\tfont-size: 16px;\n\t\t\tline-height: 16px;\n\t\t\tcolor: #777;\n\t\t}\n\t\t.qq {\n\t\t\tmargin-top: 15px;\n\t\t\tfont-size: 18px;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.qq a {\n\t\t\tdisplay: inline-block;\n\t\t\twidth: 100px;\n\t\t\theight: 30px;\n\t\t\tborder-radius: 2px;\n\t\t\tline-height: 30px;\n\t\t\ttext-decoration: none;\n\t\t\tcolor: #fff;\n\t\t\tbackground: #00b38a;\n\t\t}\n\t</style>\n\t<script type=“text/javascript” src=“https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js”></script>\n</head>\n<body>\n\t<div class=“i_error”>\n\t\t<img src="./blocked_404.png" alt=“404” width=“100%”>\n\t\t<div class=“i_logo”><img src="./lagou_logo.png" alt=“logo” width=“100%”></div>\n\t</div>\t\n\t<div class=“tip”>近期我们监控到您所用的IP地址出现异常,您的IP地址是:<span id=“ip”></span></div>\n\t<p class=“tip”>临时将此IP地址进行安全保护,但可能导致您无法正常登陆。</p>\n\t<p class=“msg”>如有问题,请发送邮件至gogo@lagou.com。带来不便,敬请谅解,谢谢!</p>\n\n\t<p class=“qq”><a id=“onlineService” href=“javascript:void(0);”>在线交流</a></p>\n\t\n\t<script type=“text/javascript”>\n\t // jQuery.ajax({\n\t // url: ‘http://wpa.b.qq.com/cgi/wpa.php’,\n\t // dataType: ‘script’,\n\t // cache: true\n\t // }).done(function() {\n\t // BizQQWPA.addCustom({aty: ‘0’, a: ‘0’, nameAccount: 800056379, selector: ‘onlineService’});\n\t // });\n\t function getQueryString(name){\n\t\t\t var reg = new RegExp("(^|&)"+ name +"=([^&])(&|$)");\n\t\t\t var r = window.location.search.substr(1).match(reg);\n\t\t\t if(r!=null){\n\t\t\t \treturn unescape(r[2]); \n\t\t\t }\n\t\t\t return “”;\n\t\t\t}\n\t\t\tdocument.getElementById(“ip”).innerHTML = encodeURI(getQueryString(“ip”));\n\t</script>\n\t<script >\n\t$(document).ready(function () {\n var selector = ‘#webchat7moor’;\n if ($(selector).length) {\n return;\n }\n var jqIframe = $(’<iframe>’, {\n id: selector.slice(1),\n src: ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’) + ‘/third-parties/webchat7moor/main_59be2f6.html’,\n style: ‘margin:0;’\n + ‘padding:0;’\n + ‘width:320px;’\n + ‘height:500px;’\n + ‘border-width:0;’\n + ‘border-radius: 3px;’\n + ‘transition: height 0.5s ease-out;’\n + ‘z-index:-99999;’\n + ‘display: none;’\n + ‘bottom:0;’\n + ‘right:0;’\n + ‘position:fixed;’\n });\n $(document.body).append(jqIframe);\n var child = jqIframe[0].contentWindow;\n var target = window.location.protocol + ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’);\n $(’#onlineService, #feedback-icon’).on(‘click’, function (e) {\n jqIframe.css(‘z-index’, 99999).show();\n child.postMessage(’{“code”:1,“message”:“open webchat plugin”}’, target);\n });\n $(window).on(‘message’, function (e) {\n var origin = e.origin || e.originalEvent.origin;\n if (origin.indexOf(target) !== 0) {\n return;\n }\n var data = e.data || e.originalEvent.data;\n if (data.code === 2 && typeof data.css !== ‘undefined’) {\n jqIframe.css(data.css);\n } else {\n jqIframe.css(‘z-index’, -99999).hide();\n }\n });\n});\n\t</script>\n</body>\n</html>\n’, read: [Function] }, req: ClientRequest { domain: null, _events: [Object], _eventsCount: 3, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, upgrading: false, chunkedEncoding: false, shouldKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: [Object], _contentLength: 0, _hasBody: true, _trailer: ‘’, finished: true, _headerSent: true, socket: [Object], connection: [Object], _header: ‘GET http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22 HTTP/1.1\r\nHost: forbidden.lagou.com:80\r\naccept-encoding: gzip, deflate, br\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36\r\napi-key: foobar\r\naccept: application/json, text/javascript, /; q=0.01\r\naccept-language: zh-CN,zh;q=0.8,en;q=0.6\r\ncache-control: no-cache\r\nconnection: keep-alive\r\norigin: http://evil.com/\r\npragma: no-cache\r\nreferer: https://www.lagou.com/jobs/list_node?city=杭州&cl=false&fromSearch=true&labelWords=&suginput=\r\nx-anit-forge-code: 0\r\nx-anit-forge-token: None\r\nx-requested-with: XMLHttpRequest\r\n\r\n’, _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, timeout: undefined, method: ‘GET’, path: ‘http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22’, _ended: true, res: [Object], aborted: undefined, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, _options: null }, response: [Circular], called: true }, req: ClientRequest { domain: null, _events: { drain: [Object], error: [Object], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 3, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, upgrading: false, chunkedEncoding: false, shouldKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: { connection: false }, _contentLength: 0, _hasBody: true, _trailer: ‘’, finished: true, _headerSent: true, socket: Socket { connecting: false, _hadError: false, _handle: [Object], _parent: null, _host: null, _readableState: [Object], readable: true, domain: null, _events: [Object], _eventsCount: 5, _maxListeners: undefined, _writableState: [Object], writable: true, allowHalfOpen: false, destroyed: false, _bytesDispatched: 686, _sockname: null, _pendingData: null, _pendingEncoding: ‘’, server: null, _server: null, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true }, connection: Socket { connecting: false, _hadError: false, _handle: [Object], _parent: null, _host: null, _readableState: [Object], readable: true, domain: null, _events: [Object], _eventsCount: 5, _maxListeners: undefined, _writableState: [Object], writable: true, allowHalfOpen: false, destroyed: false, _bytesDispatched: 686, _sockname: null, _pendingData: null, _pendingEncoding: ‘’, server: null, _server: null, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true }, _header: ‘GET http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22 HTTP/1.1\r\nHost: forbidden.lagou.com:80\r\naccept-encoding: gzip, deflate, br\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36\r\napi-key: foobar\r\naccept: application/json, text/javascript, /; q=0.01\r\naccept-language: zh-CN,zh;q=0.8,en;q=0.6\r\ncache-control: no-cache\r\nconnection: keep-alive\r\norigin: http://evil.com/\r\npragma: no-cache\r\nreferer: https://www.lagou.com/jobs/list_node?city=杭州&cl=false&fromSearch=true&labelWords=&suginput=\r\nx-anit-forge-code: 0\r\nx-anit-forge-token: None\r\nx-requested-with: XMLHttpRequest\r\n\r\n’, _headers: { host: ‘forbidden.lagou.com:80’, ‘accept-encoding’: ‘gzip, deflate, br’, ‘user-agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36’, ‘api-key’: ‘foobar’, accept: ‘application/json, text/javascript, /; q=0.01’, ‘accept-language’: ‘zh-CN,zh;q=0.8,en;q=0.6’, ‘cache-control’: ‘no-cache’, connection: ‘keep-alive’, origin: ‘http://evil.com/’, pragma: ‘no-cache’, referer: ‘https://www.lagou.com/jobs/list_node?city=杭州&cl=false&fromSearch=true&labelWords=&suginput=’, ‘x-anit-forge-code’: ‘0’, ‘x-anit-forge-token’: ‘None’, ‘x-requested-with’: ‘XMLHttpRequest’ }, _headerNames: { host: ‘Host’, ‘accept-encoding’: ‘accept-encoding’, ‘user-agent’: ‘user-agent’, ‘api-key’: ‘api-key’, accept: ‘accept’, ‘accept-language’: ‘accept-language’, ‘cache-control’: ‘cache-control’, connection: ‘connection’, origin: ‘origin’, pragma: ‘pragma’, referer: ‘referer’, ‘x-anit-forge-code’: ‘x-anit-forge-code’, ‘x-anit-forge-token’: ‘x-anit-forge-token’, ‘x-requested-with’: ‘x-requested-with’ }, _onPendingData: null, agent: ProxyAgent { domain: null, _events: {}, _eventsCount: 0, _maxListeners: undefined, callback: [Function: connect], proxy: [Object], proxyUri: ‘http://124.88.67.22:80’, proxyFn: [Function: httpOrHttpsProxy] }, socketPath: undefined, timeout: undefined, method: ‘GET’, path: ‘http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22’, _ended: true, res: IncomingMessage { _readableState: [Object], readable: false, domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, socket: [Object], connection: [Object], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: ‘1.1’, complete: true, headers: [Object], rawHeaders: [Object], trailers: {}, rawTrailers: [], upgrade: false, url: ‘’, method: null, statusCode: 200, statusMessage: ‘OK’, client: [Object], _consuming: true, _dumped: false, req: [Circular], text: '<!DOCTYPE html>\n<html lang=“en”>\n<head>\n\t<meta charset=“UTF-8”>\n\t<title>Document</title>\n\t<style>\n\t\t {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\tbody {\n\t\t\tfont-family: “Hiragino Sans GB”, “Microsoft Yahei”, “SimSun”, Arial, “Helvetica Neue”, Helvetica;\n\t\t\tbackground: #f8f9fc;\t\t\t\n\t\t}\n\t\t.i_error {\n\t\t\tposition: relative;\n\t\t\t/width: 654px;/\n\t\t\twidth: 34.0625%;\n\t\t\t/height: 467px;/\n\t\t\tmargin: 67px auto 0;\t\n\t\t\t/background: url(./blocked_404.png) 0 0 no-repeat;/\n\t\t}\n\t\t.i_logo {\n\t\t\tposition: absolute;\n\t\t\t/top: 116px;/\n\t\t\ttop: 24.8394%;\n\t\t\t/left: 68px;/\n\t\t\tleft: 9.785933%;\n\t\t\t/width: 110px;/\n\t\t\twidth: 16.819572%;\n\t\t\t/height: 41px;/\n\t\t\t/background: url(./lagou_logo.png) 0 0 no-repeat;/\n\t\t}\n\t\t.tip {\n\t\t\tmargin-top: 49px;\n\t\t\tfont-size: q8px;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t\tcolor: #333;\n\t\t}\n\t\t.msg {\n\t\t\tmargin-top: 15px;\n\t\t\ttext-align: center;\n\t\t\tfont-size: 16px;\n\t\t\tline-height: 16px;\n\t\t\tcolor: #777;\n\t\t}\n\t\t.qq {\n\t\t\tmargin-top: 15px;\n\t\t\tfont-size: 18px;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.qq a {\n\t\t\tdisplay: inline-block;\n\t\t\twidth: 100px;\n\t\t\theight: 30px;\n\t\t\tborder-radius: 2px;\n\t\t\tline-height: 30px;\n\t\t\ttext-decoration: none;\n\t\t\tcolor: #fff;\n\t\t\tbackground: #00b38a;\n\t\t}\n\t</style>\n\t<script type=“text/javascript” src=“https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js”></script>\n</head>\n<body>\n\t<div class=“i_error”>\n\t\t<img src="./blocked_404.png" alt=“404” width=“100%”>\n\t\t<div class=“i_logo”><img src="./lagou_logo.png" alt=“logo” width=“100%”></div>\n\t</div>\t\n\t<div class=“tip”>近期我们监控到您所用的IP地址出现异常,您的IP地址是:<span id=“ip”></span></div>\n\t<p class=“tip”>临时将此IP地址进行安全保护,但可能导致您无法正常登陆。</p>\n\t<p class=“msg”>如有问题,请发送邮件至gogo@lagou.com。带来不便,敬请谅解,谢谢!</p>\n\n\t<p class=“qq”><a id=“onlineService” href=“javascript:void(0);”>在线交流</a></p>\n\t\n\t<script type=“text/javascript”>\n\t // jQuery.ajax({\n\t // url: ‘http://wpa.b.qq.com/cgi/wpa.php’,\n\t // dataType: ‘script’,\n\t // cache: true\n\t // }).done(function() {\n\t // BizQQWPA.addCustom({aty: ‘0’, a: ‘0’, nameAccount: 800056379, selector: ‘onlineService’});\n\t // });\n\t function getQueryString(name){\n\t\t\t var reg = new RegExp("(^|&)"+ name +"=([^&])(&|$)");\n\t\t\t var r = window.location.search.substr(1).match(reg);\n\t\t\t if(r!=null){\n\t\t\t \treturn unescape(r[2]); \n\t\t\t }\n\t\t\t return “”;\n\t\t\t}\n\t\t\tdocument.getElementById(“ip”).innerHTML = encodeURI(getQueryString(“ip”));\n\t</script>\n\t<script >\n\t$(document).ready(function () {\n var selector = ‘#webchat7moor’;\n if ($(selector).length) {\n return;\n }\n var jqIframe = $(’<iframe>’, {\n id: selector.slice(1),\n src: ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’) + ‘/third-parties/webchat7moor/main_59be2f6.html’,\n style: ‘margin:0;’\n + ‘padding:0;’\n + ‘width:320px;’\n + ‘height:500px;’\n + ‘border-width:0;’\n + ‘border-radius: 3px;’\n + ‘transition: height 0.5s ease-out;’\n + ‘z-index:-99999;’\n + ‘display: none;’\n + ‘bottom:0;’\n + ‘right:0;’\n + ‘position:fixed;’\n });\n $(document.body).append(jqIframe);\n var child = jqIframe[0].contentWindow;\n var target = window.location.protocol + ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’);\n $(’#onlineService, #feedback-icon’).on(‘click’, function (e) {\n jqIframe.css(‘z-index’, 99999).show();\n child.postMessage(’{“code”:1,“message”:“open webchat plugin”}’, target);\n });\n $(window).on(‘message’, function (e) {\n var origin = e.origin || e.originalEvent.origin;\n if (origin.indexOf(target) !== 0) {\n return;\n }\n var data = e.data || e.originalEvent.data;\n if (data.code === 2 && typeof data.css !== ‘undefined’) {\n jqIframe.css(data.css);\n } else {\n jqIframe.css(‘z-index’, -99999).hide();\n }\n });\n});\n\t</script>\n</body>\n</html>\n’, read: [Function] }, aborted: undefined, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, _options: null }, text: '<!DOCTYPE html>\n<html lang=“en”>\n<head>\n\t<meta charset=“UTF-8”>\n\t<title>Document</title>\n\t<style>\n\t\t {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\tbody {\n\t\t\tfont-family: “Hiragino Sans GB”, “Microsoft Yahei”, “SimSun”, Arial, “Helvetica Neue”, Helvetica;\n\t\t\tbackground: #f8f9fc;\t\t\t\n\t\t}\n\t\t.i_error {\n\t\t\tposition: relative;\n\t\t\t/width: 654px;/\n\t\t\twidth: 34.0625%;\n\t\t\t/height: 467px;/\n\t\t\tmargin: 67px auto 0;\t\n\t\t\t/background: url(./blocked_404.png) 0 0 no-repeat;/\n\t\t}\n\t\t.i_logo {\n\t\t\tposition: absolute;\n\t\t\t/top: 116px;/\n\t\t\ttop: 24.8394%;\n\t\t\t/left: 68px;/\n\t\t\tleft: 9.785933%;\n\t\t\t/width: 110px;/\n\t\t\twidth: 16.819572%;\n\t\t\t/height: 41px;/\n\t\t\t/background: url(./lagou_logo.png) 0 0 no-repeat;/\n\t\t}\n\t\t.tip {\n\t\t\tmargin-top: 49px;\n\t\t\tfont-size: q8px;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t\tcolor: #333;\n\t\t}\n\t\t.msg {\n\t\t\tmargin-top: 15px;\n\t\t\ttext-align: center;\n\t\t\tfont-size: 16px;\n\t\t\tline-height: 16px;\n\t\t\tcolor: #777;\n\t\t}\n\t\t.qq {\n\t\t\tmargin-top: 15px;\n\t\t\tfont-size: 18px;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.qq a {\n\t\t\tdisplay: inline-block;\n\t\t\twidth: 100px;\n\t\t\theight: 30px;\n\t\t\tborder-radius: 2px;\n\t\t\tline-height: 30px;\n\t\t\ttext-decoration: none;\n\t\t\tcolor: #fff;\n\t\t\tbackground: #00b38a;\n\t\t}\n\t</style>\n\t<script type=“text/javascript” src=“https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js”></script>\n</head>\n<body>\n\t<div class=“i_error”>\n\t\t<img src="./blocked_404.png" alt=“404” width=“100%”>\n\t\t<div class=“i_logo”><img src="./lagou_logo.png" alt=“logo” width=“100%”></div>\n\t</div>\t\n\t<div class=“tip”>近期我们监控到您所用的IP地址出现异常,您的IP地址是:<span id=“ip”></span></div>\n\t<p class=“tip”>临时将此IP地址进行安全保护,但可能导致您无法正常登陆。</p>\n\t<p class=“msg”>如有问题,请发送邮件至gogo@lagou.com。带来不便,敬请谅解,谢谢!</p>\n\n\t<p class=“qq”><a id=“onlineService” href=“javascript:void(0);”>在线交流</a></p>\n\t\n\t<script type=“text/javascript”>\n\t // jQuery.ajax({\n\t // url: ‘http://wpa.b.qq.com/cgi/wpa.php’,\n\t // dataType: ‘script’,\n\t // cache: true\n\t // }).done(function() {\n\t // BizQQWPA.addCustom({aty: ‘0’, a: ‘0’, nameAccount: 800056379, selector: ‘onlineService’});\n\t // });\n\t function getQueryString(name){\n\t\t\t var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");\n\t\t\t var r = window.location.search.substr(1).match(reg);\n\t\t\t if(r!=null){\n\t\t\t \treturn unescape(r[2]); \n\t\t\t }\n\t\t\t return “”;\n\t\t\t}\n\t\t\tdocument.getElementById(“ip”).innerHTML = encodeURI(getQueryString(“ip”));\n\t</script>\n\t<script >\n\t$(document).ready(function () {\n var selector = ‘#webchat7moor’;\n if ($(selector).length) {\n return;\n }\n var jqIframe = $(’<iframe>’, {\n id: selector.slice(1),\n src: ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’) + ‘/third-parties/webchat7moor/main_59be2f6.html’,\n style: ‘margin:0;’\n + ‘padding:0;’\n + ‘width:320px;’\n + ‘height:500px;’\n + ‘border-width:0;’\n + ‘border-radius: 3px;’\n + ‘transition: height 0.5s ease-out;’\n + ‘z-index:-99999;’\n + ‘display: none;’\n + ‘bottom:0;’\n + ‘right:0;’\n + ‘position:fixed;’\n });\n $(document.body).append(jqIframe);\n var child = jqIframe[0].contentWindow;\n var target = window.location.protocol + ‘//’ + (window.GLOBAL_CDN_DOMAIN || ‘www.lgstatic.com’);\n $(’#onlineService, #feedback-icon’).on(‘click’, function (e) {\n jqIframe.css(‘z-index’, 99999).show();\n child.postMessage(’{“code”:1,“message”:“open webchat plugin”}’, target);\n });\n $(window).on(‘message’, function (e) {\n var origin = e.origin || e.originalEvent.origin;\n if (origin.indexOf(target) !== 0) {\n return;\n }\n var data = e.data || e.originalEvent.data;\n if (data.code === 2 && typeof data.css !== ‘undefined’) {\n jqIframe.css(data.css);\n } else {\n jqIframe.css(‘z-index’, -99999).hide();\n }\n });\n});\n\t</script>\n</body>\n</html>\n’, body: {}, files: undefined, buffered: true, headers: { server: ‘nfs’, date: ‘Wed, 05 Apr 2017 08:31:32 GMT’, ‘content-type’: ‘text/html’, ‘content-length’: ‘4093’, ‘last-modified’: ‘Tue, 27 Dec 2016 02:38:07 GMT’, connection: ‘keep-alive’, etag: ‘“5861d40f-ffd”’, ‘accept-ranges’: ‘bytes’ }, header: { server: ‘nfs’, date: ‘Wed, 05 Apr 2017 08:31:32 GMT’, ‘content-type’: ‘text/html’, ‘content-length’: ‘4093’, ‘last-modified’: ‘Tue, 27 Dec 2016 02:38:07 GMT’, connection: ‘keep-alive’, etag: ‘“5861d40f-ffd”’, ‘accept-ranges’: ‘bytes’ }, statusCode: 200, status: 200, statusType: 2, info: false, ok: true, redirect: false, clientError: false, serverError: false, error: false, accepted: false, noContent: false, badRequest: false, unauthorized: false, notAcceptable: false, forbidden: false, notFound: false, type: ‘text/html’, links: {}, setEncoding: [Function: bound ], redirects: [ ‘http://forbidden.lagou.com/forbidden/fb.html?ip=124.88.67.22’ ] }
你这。。。。 代码不格式化,却把文字格式化。。。。
对方防爬做的好呗,forbidden 这个字你应该懂了…
@DevinXian 我是从别人写的博客上参照的 ,。。。人家就可以,也还是用的superagent,还没有写headers。。。
@guirenpei 博客是什么时候的,不保证拉勾进行技术升级啊… 我猜的而已
@DevinXian 半年前的博客。。