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

Commit

Permalink
Merge pull request #1241 from greenhat616/master
Browse files Browse the repository at this point in the history
修复解析问题,改善 Docker 支持
  • Loading branch information
Binaryify authored May 24, 2021
2 parents 97bd7fe + f23fbae commit c2d7388
Show file tree
Hide file tree
Showing 8 changed files with 5,541 additions and 19 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ FROM node:lts-alpine
WORKDIR /app
COPY . /app

RUN rm -f package-lock.json \
; rm -rf .idea \
; rm -rf node_modules \
; npm config set registry "https://registry.npm.taobao.org/" \
&& npm install
RUN npm config set registry "https://registry.npm.taobao.org/" \
&& npm install --production

EXPOSE 3000
CMD ["node", "app.js"]
5 changes: 2 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ app.use((req, res, next) => {
;(req.headers.cookie || '').split(/\s*;\s*/).forEach((pair) => {
let crack = pair.indexOf('=')
if (crack < 1 || crack == pair.length - 1) return
req.cookies[
decodeURIComponent(pair.slice(0, crack)).trim()
] = decodeURIComponent(pair.slice(crack + 1)).trim()
req.cookies[decodeURIComponent(pair.slice(0, crack)).trim()] =
decodeURIComponent(pair.slice(crack + 1)).trim()
})
next()
})
Expand Down
3 changes: 2 additions & 1 deletion module/related_playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module.exports = (query, request) => {
},
).then((response) => {
try {
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
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
let result,
playlists = []
while ((result = pattern.exec(response.body)) != null) {
Expand Down
Loading

2 comments on commit c2d7388

@vercel
Copy link

@vercel vercel bot commented on c2d7388 May 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

netease-cloud-music-api – ./docs

netease-cloud-music-api-git-master-binaryify.vercel.app
neteasecloudmusicapi.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c2d7388 May 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.