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,491 @@
var express = require('express'),
router = express.Router(),
utils = require("../utils"),
config = require("../config");
var isA = true;
// 别人的后端c
router.all('*', (req, res, next) => {
isA = Boolean(req.query.isAndroid) || false
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "*");
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
res.header("X-Powered-By", 'bmy')
res.header("Content-Type", "application/json;charset=utf-8");
next();
});
// http://127.0.0.1:3000/api/json/test
router.get('/test', async (req, res, next) => {
// res.status(500)
// 200
res.json({
status: 500,
msg: '请求成功',
result: [
{ id: 1, name: 'test1' },
{ id: 2, name: 'test2' },
{ id: 3, name: 'test3' },
]
})
});
// http://127.0.0.1:3000/api/json/token
router.get('/token', async (req, res, next) => {
// 500
res.json({
status: 200,
msg: '请求成功',
result: {
title: 'token获取'
}
})
});
/**
* 【已修改正常】1获取首页推荐写真集列表 【页面完成】
* 接口地址http://127.0.0.1:3000/api/json/index
*/
router.get('/index', async (req, res, next) => {
var list = await utils.AgentPost(config.AgentUrl);
res.json({
status: 200,
msg: '请求成功',
result: list.data
})
});
// ================ 查看写真详情 接口 ======================
/**
* 【已修改正常】2进入写真集详情
* 接口地址http://127.0.0.1:3000/api/json/info
* 参数:
* id 从首页带过来的 id参数
* quantity 写真的数量
* 示例http://127.0.0.1:3000/api/json/info?id=7850&quantity=91
*
*/
router.get('/info', async (req, res, next) => {
let quantity = req.query.quantity;
let id = req.query.id;
let result = []
for (let i = 1; i<= quantity; i++) {
result.push(returnUrl(`https://tjg.gzhuibei.com/a/1/${id}/${i}.jpg`))
}
res.json({
status: 200,
msg: '请求成功',
result: result
})
})
// ================写真机构 接口 ======================
/**
* 【已修改正常】3获取各大国内外写真机构列表 【页面完成】
* 接口地址http://127.0.0.1:3000/api/json/mechanism
*/
router.get('/mechanism', async (req, res, next) => {
let $ = await utils.get(config.BaseUrl);
var result = []
$(".layui-tab-content .layui-tab-item").eq(2).find(".tags>a").each(function (index) {
result.push({
id: parseInt($(this).attr("href").split("?id=")[1]),
title: $(this).text(),
page: 1
})
})
res.json({
status: 200,
msg: '请求成功',
result: result
})
})
/**
* 【已修改正常】4获取该机构下写真套图列表 【页面完成】
* 接口地址http://127.0.0.1:3000/api/json/mechanismList
* 参数:
* page 页数 注意page默认从 0 开始
* id 接口3的id
* 示例http://127.0.0.1:3000/api/json/mechanismList?id=82&page=1
*/
router.get('/mechanismList', async (req, res, next) => {
var id = req.query.id;
var page = req.query.page;
let $ = await utils.get(config.jigouList(id, page));
var result = {
current_page: Number(page), // 当前页数
// 该分类有多少页
total_page: 1,
// 当页的数据
data: []
};
result.total_page = totalPage($)
$(".hezi ul li").each(function (i, el) {
result.data.push({
id: parseInt($(this).find("a").attr("href").split("?id=")[1]),
total: parseInt($(this).find(".shuliang").text()),
source: '',
user: clearText($(this).find("p").eq(2).text()),
tags: [],
title: $(this).find(".biaoti a").text(),
preview: returnUrl($(this).find("a img").attr("src")),
});
$(this).find("p").eq(1).find("a").each(function (index, ele) {
result.data[i].tags.push({
title: $(this).text(),
id: parseInt($(this).attr("href").split("?id=")[1])
})
})
});
res.json({
status: 200,
msg: '请求成功',
result: result
})
})
// ================ 推荐分类 接口 ======================
/**
* 【已修改正常】5获取写真分类列表 【页面完成】
* 接口地址http://127.0.0.1:3000/api/json/class
*/
router.get('/class', async (req, res, next) => {
console.log(config.BaseUrl);
let $ = await utils.get(config.BaseUrl);
var result = {
// 默认菜单
principal: [],
// 可选菜单
additional: [
{ id: 40, title: '萝莉控', page: 1 },
{ id: 104, title: '白丝诱惑', page: 1 },
{ id: 189, title: '双马尾', page: 1 },
{ id: 20, title: '护士制服', page: 1 },
{ id: 207, title: '丝足诱惑', page: 1 },
{ id: 27, title: '性感女仆装', page: 1 },
{ id: 50, title: '湿身诱惑', page: 1 },
{ id: 62, title: '御姐控', page: 1 },
{ id: 68, title: '古典气质', page: 1 },
{ id: 69, title: '旗袍美女', page: 1 },
{ id: 70, title: '人体艺术', page: 1 },
{ id: 43, title: '福利图片', page: 1 },
{ id: 75, title: '性感浴室', page: 1 },
{ id: 78, title: '性感网袜', page: 1 },
{ id: 81, title: '阳光少女', page: 1 },
{ id: 82, title: '居家私房', page: 1 },
{ id: 89, title: '巨乳波霸', page: 1 },
{ id: 110, title: '性感豹纹', page: 1 },
{ id: 100, title: '日本女明星', page: 1 },
{ id: 112, title: '空姐制服', page: 1 },
{ id: 114, title: 'SM镣铐', page: 1 },
{ id: 121, title: '粉嫩少女', page: 1 },
{ id: 122, title: '教师制服', page: 1 },
{ id: 123, title: '美女警察', page: 1 },
{ id: 145, title: '床上美女', page: 1 },
{ id: 147, title: 'OL制服', page: 1 },
{ id: 130, title: '姐妹花', page: 1 },
{ id: 131, title: '性感健身', page: 1 },
{ id: 125, title: '美厨娘', page: 1 },
{ id: 128, title: '情趣皮衣', page: 1 },
{ id: 134, title: '透视诱惑', page: 1 },
{ id: 146, title: '美女秘书', page: 1 },
{ id: 157, title: '西装美女', page: 1 },
{ id: 184, title: '黑长直', page: 1 },
{ id: 190, title: '老照片美女', page: 1 },
{ id: 191, title: '肉感美女', page: 1 },
{ id: 192, title: '学生装美女', page: 1 },
{ id: 194, title: '写真杂志', page: 1 },
{ id: 195, title: '欧美巨乳', page: 1 },
{ id: 196, title: '金发美女', page: 1 },
{ id: 197, title: '欧美熟妇', page: 1 },
{ id: 199, title: '欧美制服', page: 1 },
{ id: 201, title: '黑人美女', page: 1 },
{ id: 202, title: '巨乳肥臀', page: 1 },
{ id: 203, title: '长靴美女', page: 1 },
{ id: 204, title: '丝袜美臀', page: 1 },
{ id: 206, title: '美臀少妇', page: 1 },
{ id: 228, title: '美女制服诱惑', page: 1 },
{ id: 211, title: '不知火舞COS', page: 1 },
{ id: 212, title: '性感女郎', page: 1 },
{ id: 213, title: '丝袜女郎', page: 1 },
{ id: 214, title: '轻熟女写真集', page: 1 },
{ id: 215, title: '比基尼少女', page: 1 },
{ id: 216, title: '日本比基尼', page: 1 },
{ id: 217, title: '中国比基尼', page: 1 },
{ id: 219, title: '风骚诱惑', page: 1 },
{ id: 220, title: '风骚少妇', page: 1 },
{ id: 221, title: '丰满少妇', page: 1 },
{ id: 222, title: '丝袜少妇', page: 1 },
{ id: 224, title: '黑丝美腿', page: 1 },
{ id: 225, title: '黑丝制服', page: 1 },
{ id: 226, title: '街拍黑丝', page: 1 },
{ id: 227, title: '日本巨乳AV女优', page: 1 },
{ id: 229, title: '蕾丝诱惑', page: 1 },
{ id: 231, title: '半裸尤物', page: 1 },
{ id: 232, title: '勾魂尤物', page: 1 },
{ id: 233, title: '丝袜肥臀', page: 1 },
{ id: 235, title: '街拍美腿', page: 1 },
{ id: 236, title: '巨乳萝莉', page: 1 },
{ id: 237, title: '丝袜制服', page: 1 },
{ id: 238, title: '街拍短裙', page: 1 },
{ id: 239, title: '丝袜短裙', page: 1 },
{ id: 240, title: '丝袜人体艺术', page: 1 },
{ id: 242, title: '性感丰满', page: 1 },
{ id: 243, title: '街拍丝袜', page: 1 },
{ id: 244, title: '超短迷你裙', page: 1 },
{ id: 245, title: '开背毛衣', page: 1 },
{ id: 247, title: '性感香车', page: 1 },
{ id: 248, title: '吊带美女', page: 1 },
{ id: 249, title: '极品美丝', page: 1 },
{ id: 250, title: '眼镜娘', page: 1 },
{ id: 251, title: '极品女友', page: 1 },
{ id: 53, title: '大胸嫩模', page: 1 },
{ id: 73, title: '情趣内衣', page: 1 },
{ id: 254, title: '白领丽人', page: 1 },
{ id: 255, title: '美女故事', page: 1 },
{ id: 256, title: '极品抹胸', page: 1 },
{ id: 257, title: '情趣制服', page: 1 },
{ id: 258, title: '肉丝高跟', page: 1 },
{ id: 259, title: '黑丝袜诱惑', page: 1 },
{ id: 113, title: '婚纱美女', page: 1 },
{ id: 108, title: '丽柜美束系列', page: 1 },
]
};
$(".layui-tab-content .layui-tab-item").eq(1).find(".tags>a").each(function (index) {
// if (index < 10) {
result.additional.unshift({
id: parseInt($(this).attr("href").split("?id=")[1]),
title: $(this).text(),
page: 1
})
// }
})
result.principal.unshift({ id: 18, title: '热裤', page: 1 })
result.principal.unshift({ id: 127, title: '紧身裤', page: 1 })
result.principal.unshift({ id: 64, title: '丁字裤', page: 1 })
result.principal.unshift({ id: 10, title: '办公室', page: 1 })
result.principal.unshift({ id: 253, title: '黑丝萝莉', page: 1 })
result.principal.unshift({ id: 46, title: '翘臀', page: 1 })
result.principal.unshift({ id: 124, title: 'JK制服', page: 1 })
result.principal.unshift({ id: 12, title: '长筒袜', page: 1 })
result.principal.unshift({ id: 67, title: '捆绑绳艺', page: 1 })
result.principal.unshift({ id: 65, title: '街拍', page: 1 })
result.principal.unshift({ id: 252, title: '白丝萝莉', page: 1 })
result.principal.unshift({ id: 36, title: 'COSPLAY', page: 1 })
result.principal.unshift({ id: 48, title: '猫女郎', page: 1 })
// 【必看】模特列表https://www.tujigu.com/s/85/
// 网红美女、网红模特写真 https://www.tujigu.com/s/116/
// 日本AV女优写真 https://www.tujigu.com/s/159/
// B罩杯美女 https://www.tujigu.com/s/170/ 171 172 173 174 175 176 177 178 179
res.json({
status: 200,
msg: '请求成功',
result: result
})
})
/**
* 【已修改正常】6进入分类的详情列表获取该分类下有多少套图用在接口5上
* 接口地址http://127.0.0.1:3000/api/json/classList
* 参数:
* page 页数 注意page默认从 1 开始
* id 代入的接口4 id 或者 接口1 的tags id
* 示例http://127.0.0.1:3000/api/json/classList?id=124&page=1
*/
router.get('/classList', async (req, res, next) => {
var id = req.query.id;
var page = req.query.page;
let $ = await utils.get(config.ClassList(id, page));
var result = {
current_page: Number(page), // 当前页数
// 该分类有多少页
total_page: 1,
// 当页的数据
data: []
};
result.total_page = totalPage($)
$(".hezi ul li").each(function (i, el) {
result.data.push({
id: parseInt($(this).find("a").attr("href").split("?id=")[1]),
total: parseInt($(this).find(".shuliang").text()),
source: clearText(`来源机构:${$(this).find("p").eq(0).find("a").text()}`),
user: clearText($(this).find("p").eq(2).text()),
tags: [],
title: $(this).find(".biaoti a").text(),
preview: returnUrl($(this).find("a img").attr("src")),
});
$(this).find("p").eq(1).find("a").each(function (index, ele) {
result.data[i].tags.push({
title: $(this).text(),
id: parseInt($(this).attr("href").split("?id=")[1])
})
})
});
res.json({
status: 200,
msg: '请求成功',
result: result
})
})
// ================ 模特相关 接口 ======================
/**
* 【已修改正常】7获取所有模特
* 接口地址http://127.0.0.1:3000/api/json/allModel
* 示例http://127.0.0.1:3000/api/json/allModel
*/
router.get('/allModel', async (req, res, next) => {
let $ = await utils.get(`${config.AgentUrl}&c=Renwu&a=index`);
res.json({
status: 200,
msg: '请求成功',
result: $.data
})
});
/**
* 【已修改正常】8进入模特的个人套图页可用于 接口1 的 model
* 接口地址http://127.0.0.1:3000/api/json/modelList
* 参数:
* page 页数 注意page默认从 1 开始
* id 从首页带过来的 id参数
* 示例http://127.0.0.1:3000/api/json/modelList?id=3265&page=1
*/
router.get('/modelList', async (req, res, next) => {
var id = req.query.id;
var page = req.query.page;
let promise1 = await utils.get(`${config.AgentUrl}&c=Renwu&a=detail&id=${id}`);
let promise2 = await utils.get(`${config.AgentUrl}&c=Renwu&a=tulist&id=${id}&p=${page}`);
console.log("pr1: ", `${config.AgentUrl}&c=Renwu&a=detail&id=${id}`)
console.log("pr2: ", `${config.AgentUrl}&c=Renwu&a=tulist&id=${id}&p=${page}`)
var result = {
current_page: Number(page),
total_page: 1,
model_info: {
portrait: 0,
name: 0,
explain: 0
},
data: []
}
Promise.all([promise1, promise2]).then((values) => {
result.total_page = Number(values[1].data.total)
result.data = values[1].data.list
result.model_info.portrait = values[0].data.img_src
result.model_info.name = values[0].data.title
result.model_info.explain = values[0].data.des
res.json({
status: 200,
msg: '请求成功',
result: result
})
});
})
// ================ 搜索 接口 ======================
/**
*【已修改正常】9根据关键词搜索写真接口
* 接口地址http://127.0.0.1:3000/api/json/search
* 参数:
* keyword 搜索关键词
* 示例http://127.0.0.1:3000/api/json/search?keyword=jk&page=1
*/
router.get('/search', async (req, res, next) => {
var keyword = req.query.keyword;
var page = req.query.page;
let $ = await utils.get(`${config.AgentUrl}&c=Search&a=Tuji&key=${encodeURIComponent(keyword)}&p=${page}`)
res.json({
status: 200,
msg: '请求成功',
result: $.data
})
})
/**
* 10: 破解有防盗链的图片地址
* 接口地址http://127.0.0.1:3000/api/json/url
* 参数:
* url 图片地址
* 示例http://127.0.0.1:3000/api/json/url?url=https://lns.hywly.com/a/1/24510/0.jpg
*/
router.get('/url', async (req, res, next) => {
const http = require('https');
const URL = require('url');
var url = URL.parse(req.query.url);
var option = {
hostname: url.hostname,
path: url.path,
rejectUnauthorized: false,
headers: {
"Referer": config.BaseUrl
}
};
http.get(option, function (response) {
var chunks = [];
response.on('data', function (chunk) {
chunks.push(chunk);
}).on('end', function () {
// 保存图片ArrayBuffer 数据
var buffer = Buffer.concat(chunks);
// 设置前端请求头
res.set(response.headers)
// 两次二进制转换
res.end(buffer.toString("binary"), 'binary')
});
});
});
function totalPage($) {
var total_page = 0;
$("#pages a").each(function () {
if ($(this).text().includes("末页")) {
total_page = Number($(this).attr("href").split("&page=")[1])
}
});
return total_page;
}
function returnUrl(url) {
isA = false;
return isA ? url : config.CrackUrl + url
}
function clearText(text) {
return text.replace(/\ +/g, "").replace(/[\r\n]/g, "");;
}
module.exports = router;