first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
var URL = "http://m.imomoe.in/";
// var iconv = require('iconv-lite');
const cheerio = require('cheerio');
const fs = require("fs")
const request = require('request');
var infoHtml = 'https://www.90tu.com/xingganmeinv/8552.html';
// request('https://www.90tu.com/xingganmeinv/', function (error, response, body) {
// console.log(body);
// var $ = cheerio.load(body)
// $(".clearh10").parent().find("ul li").each(function(){
// let imgUrl = $(this).find("img").attr("src")
// console.log();
// request(imgUrl).pipe(fs.createWriteStream(`./img/${$(this).find("span").text()}.png`))
// });
// });
request(infoHtml, function (error, response, body) {
var $ = cheerio.load(body)
let lastA = $(".page1 a")[$(".page1 a").length - 1];
var url = $(lastA).attr("href");
var totalPage = url.match(/_([\s\S]*?).html/)[1];
for (var i=1;i<=totalPage;i++) {
if (i == 1) {
DownImg($(".spanlr a img").attr("src"))
} else {
let a = `https://www.90tu.com/xingganmeinv/8552_${i}.html`
console.log(a);
get(a)
}
}
});
function get(url) {
request(url, function (error, response, body) {
var $ = cheerio.load(body);
DownImg($(".spanlr a img").attr("src"))
})
}
function DownImg(url) {
request(url).pipe(fs.createWriteStream(`./img/${Math.random(0,100)}${(new Date()).valueOf()}.png`))
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
后端html文件
</body>
</html>

View File

@@ -0,0 +1,4 @@
var utils = require("./utils")
console.log(utils.testTwo());

View File

@@ -0,0 +1,17 @@
{
"name": "2020-09-01",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"cheerio": "^1.0.0-rc.3",
"iconv-lite": "^0.6.2",
"request": "^2.88.2"
}
}

View File

@@ -0,0 +1,19 @@
var http = require("http");
var url = require("url");
var fs = require("fs");
function start() {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
var html = fs.readFileSync("./index.html", 'UTF-8').toString()
console.log(html);
response.writeHead(200, {"Content-Type": "text/html;charset=UTF-8"});
response.write(html);
response.end();
}
http.createServer(onRequest).listen(8888);
console.log("Server has started.");
}
start();

View File

@@ -0,0 +1,22 @@
// module.exports = {
// test() {
// return "哈哈哈哈哈"
// }
// }
exports.testOne = function() {
return "testOne"
}
exports.testTwo = function() {
return "testTwo"
}
exports.testThree = function() {
return "testThree"
}
{
}