mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-05 21:58:56 +08:00
parent
844dabeeff
commit
1a3a9d3df6
@ -1,4 +1,7 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
### 4.6.0 | 2022.05.29
|
||||||
|
- 修复请求接口提示需要验证的问题 [#1541](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1541)
|
||||||
|
|
||||||
### 4.5.14 | 2022.05.06
|
### 4.5.14 | 2022.05.06
|
||||||
- 修复获取歌单所有歌曲接口分页问题 [#1524](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/1524)
|
- 修复获取歌单所有歌曲接口分页问题 [#1524](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/1524)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "NeteaseCloudMusicApi",
|
"name": "NeteaseCloudMusicApi",
|
||||||
"version": "4.5.14",
|
"version": "4.6.0",
|
||||||
"description": "网易云音乐 NodeJS 版 API",
|
"description": "网易云音乐 NodeJS 版 API",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app.js",
|
"start": "node app.js",
|
||||||
|
@ -5,6 +5,7 @@ const http = require('http')
|
|||||||
const https = require('https')
|
const https = require('https')
|
||||||
const tunnel = require('tunnel')
|
const tunnel = require('tunnel')
|
||||||
const { URLSearchParams, URL } = require('url')
|
const { URLSearchParams, URL } = require('url')
|
||||||
|
const config = require('../util/config.json')
|
||||||
// request.debug = true // 开启可看到更详细信息
|
// request.debug = true // 开启可看到更详细信息
|
||||||
|
|
||||||
const chooseUserAgent = (ua = false) => {
|
const chooseUserAgent = (ua = false) => {
|
||||||
@ -50,7 +51,11 @@ const createRequest = (method, url, data, options) => {
|
|||||||
headers['Referer'] = 'https://music.163.com'
|
headers['Referer'] = 'https://music.163.com'
|
||||||
if (options.realIP) headers['X-Real-IP'] = options.realIP
|
if (options.realIP) headers['X-Real-IP'] = options.realIP
|
||||||
// headers['X-Real-IP'] = '118.88.88.88'
|
// headers['X-Real-IP'] = '118.88.88.88'
|
||||||
if (typeof options.cookie === 'object')
|
if (typeof options.cookie === 'object') {
|
||||||
|
if (!options.cookie.MUSIC_U) {
|
||||||
|
// 匿名
|
||||||
|
options.cookie.MUSIC_A = config.anonymous_token
|
||||||
|
}
|
||||||
headers['Cookie'] = Object.keys(options.cookie)
|
headers['Cookie'] = Object.keys(options.cookie)
|
||||||
.map(
|
.map(
|
||||||
(key) =>
|
(key) =>
|
||||||
@ -59,11 +64,10 @@ const createRequest = (method, url, data, options) => {
|
|||||||
encodeURIComponent(options.cookie[key]),
|
encodeURIComponent(options.cookie[key]),
|
||||||
)
|
)
|
||||||
.join('; ')
|
.join('; ')
|
||||||
else if (options.cookie) headers['Cookie'] = options.cookie
|
} else if (options.cookie) {
|
||||||
|
headers['Cookie'] = options.cookie
|
||||||
if (!headers['Cookie']) {
|
|
||||||
headers['Cookie'] = options.token || ''
|
|
||||||
}
|
}
|
||||||
|
console.log(options.cookie, headers['Cookie'])
|
||||||
if (options.crypto === 'weapi') {
|
if (options.crypto === 'weapi') {
|
||||||
let csrfToken = (headers['Cookie'] || '').match(/_csrf=([^(;|$)]+)/)
|
let csrfToken = (headers['Cookie'] || '').match(/_csrf=([^(;|$)]+)/)
|
||||||
data.csrf_token = csrfToken ? csrfToken[1] : ''
|
data.csrf_token = csrfToken ? csrfToken[1] : ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user