欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

裁判文书网爬虫js解密思路

程序员文章站 2022-05-02 23:35:06
裁判文书网爬虫js解密思路 1.使用node.js本地搭建web,运行js,返回解密结果.getvalue()函数获取解密结果 // 创建服务器 http.createserver( fu...

裁判文书网爬虫js解密思路

1.使用node.js本地搭建web,运行js,返回解密结果.getvalue()函数获取解密结果

	// 创建服务器
	http.createserver( function (request, response) {
    // 解析请求,包括文件名
    var pathname = url.parse(request.url).pathname;

    // 输出请求的文件名
    console.log("request for " + pathname + " received.");
    cookie=url.parse(request.url).query.split('=')[1]
    data=getvalue(cookie)
    console.log(url.parse(request.url).query.split('=')[1]);
    response.writehead(200, {'content-type': 'text/html',});


    // response.writehead(200, {'connection': 'close'});

    // 响应文件内容
    response.write(data.tostring());
    response.end();
}).listen(8080);

// 控制台会输出以下信息
console.log('server running at https://127.0.0.1:8080/');

2.js解密:

js代码copy过来不能直接使用,getcookie()函数改写成从python代码中输入变量到js代码中. 立即执行代码修改:(function(ctx){........}{this} 改为window = {};(function(ctx){........}{window}
仅供自己学习记录