修改获取总页数
This commit is contained in:
@@ -6,10 +6,12 @@ import tagsRouter from "./router/tags.js";
|
||||
import infoRouter from "./router/info.js";
|
||||
import searchRouter from "./router/search.js";
|
||||
import homeRouter from "./router/home.js";
|
||||
|
||||
import http from "http";
|
||||
|
||||
const app = express()
|
||||
|
||||
|
||||
|
||||
//解决跨域
|
||||
app.use((req, res, next) => {
|
||||
// 设置是否运行客户端设置 withCredentials
|
||||
@@ -32,7 +34,7 @@ app.use('/v1/api/info', infoRouter);
|
||||
app.use('/v1/api/search', searchRouter);
|
||||
app.use('/v1/api/home', homeRouter);
|
||||
|
||||
app.listen(config.port, () => {
|
||||
http.createServer(app).listen(config.port, "::",() => {
|
||||
console.log(`
|
||||
爬虫运行在下面网址:
|
||||
|
||||
@@ -42,5 +44,15 @@ app.listen(config.port, () => {
|
||||
`)
|
||||
})
|
||||
|
||||
// app.listen(config.port, () => {
|
||||
// console.log(`
|
||||
// 爬虫运行在下面网址:
|
||||
|
||||
// 1️⃣ 公网 IPV6: http://[${ipv6()}]:${config.port}
|
||||
// 2️⃣ 局域网 IPV4: http://${ipv4()}:${config.port}
|
||||
|
||||
// `)
|
||||
// })
|
||||
|
||||
|
||||
export default app
|
||||
@@ -44,7 +44,7 @@ router.get('/key', async (req, res) => {
|
||||
let $ = await Util.get(`${Config.baseUrl}/page/${page}?s=${encodeURI(keyword)}&type=post`)
|
||||
let result = {
|
||||
currentPage: page,
|
||||
totalPage: Number($(".pagenav a").eq(1).text()),
|
||||
totalPage: Number($(".pagenav .dots+a").text()),
|
||||
message: $(".search-content .badg .focus-color").text(),
|
||||
list: [],
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ router.get('/info', async (req, res) => {
|
||||
let result = {
|
||||
count: $(".content-layout .title-h-left .icon-spot").text().replace(/[^\d]/g, ""),
|
||||
introduce: $(".content-layout .muted-2-color").text(),
|
||||
totalPage: $(".pagenav a").eq(2).text(),
|
||||
totalPage: Number($(".pagenav .dots+a").text()),
|
||||
currentPage: page,
|
||||
list: []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user