【人工智能】后台:nodejs;数据库:MySQL;前端:HTML5
nodejs吧
全部回复
仅看楼主
level 1
2017年04月18日 09点04分 1
level 1
20170418已建成【人工智能】搜索引擎第一步
++ 将百度搜索引擎导入到自己的网站中(https://ko-orz.com/AI/search)
下面贴转发的nodejs源码
2017年04月18日 10点04分 2
level 1
const PORT = 3031;
const http = require('http');
const url = require('url');
const path = require('path');
// 获取时间
var startTime = new Date().getTime();
var server = http.createServer(s);
function s(req, res) {
res.setHeader("Access-Control-Allow-Origin", "*");
var pathname = url.parse(req.url).pathname;
var arg = url.parse(req.url, true).query;
if (pathname == "/s") {
var html = "";
var n = 0;
var baiduUrl = "http://m.baidu.com/s?wd=" + (arg.wd ? arg.wd : arg.word);
console.log(baiduUrl);
http.get(encodeURI(baiduUrl), function (response) {
response.on("data", function (d) {
// console.log("==> ", d);
console.log(n++)
html += d;
})
response.on("end", function () {
res.write(html);
res.end();
})
})
}
};
server.listen(PORT);
console.log("Server runing at port: " + PORT + ".");
2017年04月18日 10点04分 3
level 1
厉害了,向大佬低头。
2017年04月19日 08点04分 4
level 1
这和人工智能有什么关系?请求转发?
2018年05月28日 05点05分 5
level 13
厉害了,向大佬低头。
2018年05月28日 12点05分 6
1