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,101 @@
const axios = require("axios");
const iconv = require("iconv-lite");
const cheerio = require("cheerio");
const fs = require("fs");
var url = "http://www.netbian.com/dongman/";
var urlArr = [];
var imgUrlArr = [];
var index = 0;
var urlIndex = 6;
for (var i = 9; i <= 136; i++) {
if (i == 1) {
urlArr.push(url);
} else {
urlArr.push(`${url}index_${i}.htm`);
}
}
async function getSiteHtml() {
console.log(`${index + 1} 页,请求地址为:`, urlArr[index]);
let res = await axios({
method: "get",
url: urlArr[index],
responseType: "arraybuffer",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
Cookie:
"__yjs_duid=1_b9d996b2175dc2d7535f6766d95151c11626417252241; Hm_lvt_14b14198b6e26157b7eba06b390ab763=1626417252; xygkqecookieinforecord=%2C7-23654%2C; xygkqecookieclassrecord=%2C7%2C4%2C3%2C29%2C19%2C; yjs_js_security_passport=fd52428938eab0e648019f36164ac5c0fcfcf108_1626421470_js; Hm_lpvt_14b14198b6e26157b7eba06b390ab763=1626421860",
Host: "www.netbian.com",
Accept:
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
},
});
let $ = cheerio.load(iconv.decode(res.data, "gbk"));
jxHtml($);
}
async function jxHtml($) {
$(".list li img").each(function (i) {
var src = $(this).attr("src");
if (src.includes("small")) {
src = src.replace("small", "");
src = src.replace(src.substr(-14), ".jpg");
imgUrlArr.push(src);
}
if (src.includes("newc")) {
console.log("===========================");
console.log(`1: 系统检测到不符合规律的图片,请手动处理`);
console.log(`访问路径:${urlArr[index]}, 第: ${i} 张图`);
console.log("===========================");
}
});
downImage();
}
async function downImage() {
console.log("imgUrlArr[urlIndex] ====== ", imgUrlArr[urlIndex]);
try {
var jpgFileName = Date.now() + Math.random() + ".jpg";
var res = await axios({
method: "get",
url: imgUrlArr[urlIndex],
responseType: "stream",
});
res.data.pipe(fs.createWriteStream(`img/${jpgFileName}`));
console.log(
`当前第:${index + 1} 页,第:${urlIndex + 1} 张图:${imgUrlArr[urlIndex]}`
);
if (urlIndex <= imgUrlArr.length - 2) {
setTimeout(() => {
urlIndex += 1;
downImage();
}, 1000);
} else {
console.log("上一页结束");
urlIndex = 0;
imgUrlArr = [];
setTimeout(() => {
index += 1;
getSiteHtml();
}, 2000);
}
} catch (error) {
console.log("===========================");
console.log(`2: 系统检测到不符合规律的图片,请手动处理`);
console.log(`访问路径:${urlArr[index]}, 第: ${urlIndex} 张图`);
console.log("===========================");
setTimeout(() => {
urlIndex += 1;
downImage();
}, 1000);
}
}
getSiteHtml();

View File

@@ -0,0 +1,17 @@
{
"name": "nodestudy",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node pachong.js"
},
"keywords": [],
"author": "bmy",
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"cheerio": "^1.0.0-rc.10",
"iconv-lite": "^0.6.3"
}
}

View File

@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
[v-cloak] {
display: none;
}
</style>
</head>
<body>
<div class="app" v-cloak>
<h1>{{ test }}</h1>
<a :href="url">你好</a>
<div v-html="h2html"></div>
<div v-text="h2html"></div>
<ul>
<li v-for="(v,i) in newsList" :key="i">
{{ i }} {{ v.title }}
</li>
</ul>
<div v-show="isShow">
v-show 指令学习
</div>
<div v-if="vipLeave == 1">vip1</div>
<div v-else-if="vipLeave == 2">vip2</div>
<div v-else-if="vipLeave == 3">vip3</div>
<div v-else-if="vipLeave == 4">vip4</div>
<div v-else>暂无vip</div>
<input type="text" v-model="userName" placeholder="请输入用户名">
{{ userName }}
<div v-once>{{userName}}</div>
<button @click="hello(1)">登 录</button>
<span v-pre>{{ test }}</span>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
// vue 指令
// v-bind 将变量绑定到标签的属性上 简写 :
// v-html 将变量渲染为html
// v-text 将变量渲染为text文本
// v-for 遍历数组
// v-show 根据一个变量的true或false决定元素是否显示 只是对元素进行 display none 和 block 的设置
// v-if v-else 不符合条件的元素,不在代码里面显示,直接被删除
// v-model 获取输入框的内容
// v-on 绑定点击事件 @
var vm = new Vue({
el: ".app",
data: {
test: '你好我是vue',
url: "http://www.netbian.com/dongman/",
h2html: "<h2>我是h2</h2>",
newsList: [
{ title: '测试新闻1',id: 1 },
{ title: '测试新闻2',id: 2 },
{ title: '测试新闻3',id: 3 },
{ title: '测试新闻4',id: 4 },
{ title: '测试新闻5',id: 5 }
],
isShow: false,
vipLeave: 3,
userName: "张三"
},
methods: {
hello(a) {
console.log(a)
console.log(this.userName)
},
test2() {}
}
})
</script>
</html>

View File

@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body,ul,li {
margin: 0;
padding: 0;
}
.tabs {
width: 300px;
margin: 10% auto;
}
.title {
display: flex;
align-items: center;
height: 45px;
justify-content: space-between;
}
.title .active {
color: red;
}
.tabs_content .c_item {
display: none;
}
.tabs_content .active {
display: block !important;
}
</style>
</head>
<body>
<div class="app">
<div class="tabs">
<div class="title">
<div @click="changeTitle(i)" class="tabs_title"
:class="i == currentIndex ? 'active': '' "
v-for="(v,i) in tab">{{ v.title }}</div>
</div>
<div class="tabs_content">
<div class="c_item" :class="i == currentIndex ? 'active' : '' " v-for="(v, i) in tab">
<p v-for="item in v.content">{{ item.content }}</p>
</div>
</div>
</div>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
new Vue({
el: '.app',
data: {
currentIndex: 0,
tab: [
{
title: '社会',
content: [
{ content: '社会的内容1' },
{ content: '社会的内容2' },
{ content: '社会的内容3' },
]
},
{
title: '军事',
content: [
{ content: '军事的内容1' },
{ content: '军事的内容2' },
{ content: '军事的内容3' },
]
},
{
title: '财经',
content: [
{ content: '财经的内容1' },
{ content: '财经的内容2' },
{ content: '财经的内容3' },
]
}
]
},
methods: {
changeTitle(i) {
this.currentIndex = i
console.log(i)
}
}
})
</script>
</html>

View File

@@ -0,0 +1,35 @@
vuemvvm框架
mmodelvviewvmmodelview
model 数据 ajax 数据
view 页面
vm数据和页面
mmodelvviewccontroller
model数据数据库
view页面
controller控制器
vue
版本变化
vue 2.x
vue 3.x
语法变化:
1option api 60%
2class api 10%
3commposition api 30%
1: 组件基础 https://cn.vuejs.org/v2/guide/components.html
2prop https://cn.vuejs.org/v2/guide/components-props.html
3插槽 https://cn.vuejs.org/v2/guide/components-slots.html
4过渡动画 https://cn.vuejs.org/v2/guide/transitions.html
5路由https://router.vuejs.org/zh/guide/
6混入https://cn.vuejs.org/v2/guide/mixins.html
7自定义指令 https://cn.vuejs.org/v2/guide/custom-directive.html
8过滤器 https://cn.vuejs.org/v2/guide/filters.html

View File

@@ -0,0 +1,21 @@
nodejs
是js运行在后端服务器上的运行环境
c++ + v8
node
npm 依赖管理工具
npm install 插件名
npm i 插件名 --save 把插件安装到正式阶段 dependencies
npm i 插件名 --save-dev 把插件安装到开发阶段 devdependencies
npm i 插件名 -g 把插件安装到系统全局
npm uninstall 插件名
nodejs 项目必须要有个配置文件
npm init -y
package.json