Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit c2d7388

Browse files
authored
Merge pull request #1241 from greenhat616/master
修复解析问题,改善 Docker 支持
2 parents 97bd7fe + f23fbae commit c2d7388

8 files changed

+5541
-19
lines changed

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

Dockerfile

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ FROM node:lts-alpine
33
WORKDIR /app
44
COPY . /app
55

6-
RUN rm -f package-lock.json \
7-
; rm -rf .idea \
8-
; rm -rf node_modules \
9-
; npm config set registry "https://registry.npm.taobao.org/" \
10-
&& npm install
6+
RUN npm config set registry "https://registry.npm.taobao.org/" \
7+
&& npm install --production
118

129
EXPOSE 3000
1310
CMD ["node", "app.js"]

app.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ app.use((req, res, next) => {
4242
;(req.headers.cookie || '').split(/\s*;\s*/).forEach((pair) => {
4343
let crack = pair.indexOf('=')
4444
if (crack < 1 || crack == pair.length - 1) return
45-
req.cookies[
46-
decodeURIComponent(pair.slice(0, crack)).trim()
47-
] = decodeURIComponent(pair.slice(crack + 1)).trim()
45+
req.cookies[decodeURIComponent(pair.slice(0, crack)).trim()] =
46+
decodeURIComponent(pair.slice(crack + 1)).trim()
4847
})
4948
next()
5049
})

module/related_playlist.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ module.exports = (query, request) => {
1313
},
1414
).then((response) => {
1515
try {
16-
const pattern = /<div class="cver u-cover u-cover-3">[\s\S]*?<img src="([^"]+)">[\s\S]*?<a class="sname f-fs1 s-fc0" href="([^"]+)"[^>]*>([^<]+?)<\/a>[\s\S]*?<a class="nm nm f-thide s-fc3" href="([^"]+)"[^>]*>([^<]+?)<\/a>/g
16+
const pattern =
17+
/<div class="cver u-cover u-cover-3">[\s\S]*?<img src="([^"]+)">[\s\S]*?<a class="sname f-fs1 s-fc0" href="([^"]+)"[^>]*>([^<]+?)<\/a>[\s\S]*?<a class="nm nm f-thide s-fc3" href="([^"]+)"[^>]*>([^<]+?)<\/a>/g
1718
let result,
1819
playlists = []
1920
while ((result = pattern.exec(response.body)) != null) {

0 commit comments

Comments
 (0)