
1 'use strict';
2
北京PK10赛车 3 module.exports={
4
5 summary: 'the default rule for AnyProxy',
6
7
20 *beforeSendRequest(requestDetail) {
21 console.log('this is request')
北京PK10赛车 22 return null;
23 },
24
25
26
32 *beforeSendResponse(requestDetail, responseDetail) {
33 if (requestDetail.url.indexOf('') >=0) { //北京PK10赛车达人的详细信息app端
34 const newResponse=responseDetail.response;
35 newResponse.body=newResponse.body.toString();
36 const posturl="/WebCrawler/douyin北京PK10赛车/AppUserData"
37 HttpPost(newResponse.body,requestDetail.url,posturl)
38 console.log('传送app端达人的详细信息')
39
40 }
41
42
43
44 return null;
45 },
46
47
48
55 *beforeDealHttpsRequest(requestDetail) {
北京PK10赛车 56 return null;
57 },
58
59
66 *onError(requestDetail, error) {
北京PK10赛车 67 return null;
68 },
69
70
71
北京PK10赛车 78 *onConnectError(requestDetail, error) {
79 return null;
80 },
81
82
83
北京PK10赛车 90 *onClientSocketError(requestDetail, error) {
91 return null;
92 },
93 };
94
95
97 function HttpPost(json,url,path) {//将json发送到服务器,str为json内容,url为历史消息页面地址,path是接收程序的路径和文件名
98 console.log("开始执行转发操作");
北京PK10赛车 99 try{
100 var http=require('http');
101 var data={
102 json: json,
103 url: encodeURIcomponent(url),
104 data:'Im jiehuhu'
105 };
106 data=require('querystring').stringify(data);
107 var options={
108 me北京PK10赛车thod: "POST",
109 host: "127.0.0.1",//注意没有这是服务器的域名。
110 port: 8080,
111 path: path,//接收程序的路径和文件名
112 headers: {
113 'Content-Type': 'application/x- charset=UTF-8',
北京PK10赛车 114 "Content-Length": data.length
北京PK10赛车 115 }
116 };
北京PK10赛车 117 var req=http.request(options, function (res) {
118 res.setEncoding('utf8');
北京PK10赛车 119 res.on('data', function (chunk) {
北京PK10赛车 120 console.log('BODY: ' + chunk);
北京PK10赛车 121 });
122 });
123 req.on('error', function (e) {
124 console.log('problem with request: ' + e.message);
125 });
126
127 req.write(data);
128 req.end();
北京PK10赛车 129 }catch(e){
130 console.log("错误信息:"+e);
131 }
132
133 console.log("转发操作结束"+req);
134 }
北京PK10赛车
发表评论 (已有0条评论)
北京PK10赛车 还木有评论哦,快来抢沙发吧~