Skip to content

Commit

Permalink
fix netease incorrect playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
xizeyoupan committed Sep 8, 2023
1 parent 47b51f5 commit cbc4270
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { get_runtime } from "./util.js"

let OVERSEAS = globalThis?.Deno?.env?.get("OVERSEAS") || globalThis?.process?.env?.OVERSEAS
const YT_API = globalThis?.Deno?.env?.get("YT_API") || globalThis?.process?.env?.YT_API
const YT_API = globalThis?.Deno?.env?.get("YT_API") || globalThis?.process?.env?.YT_API
const runtime = get_runtime()

if (['cloudflare', 'vercel'].includes(runtime)) OVERSEAS = true
Expand All @@ -10,8 +10,11 @@ const PORT = globalThis?.Deno?.env?.get("PORT") || globalThis?.process?.env?.POR

OVERSEAS = Boolean(OVERSEAS)

const net_ease_anonymous_token = "de91e1f8119d32e01cc73efcb82c0a30c9137e8d4f88dbf5e3d7bf3f28998f21add2bc8204eeee5e56c0bbb8743574b46ca2c10c35dc172199bef9bf4d60ecdeab066bb4dc737d1c3324751bcc9aaf44c3061cd18d77b7a0"

export default {
YT_API,
OVERSEAS,
PORT
PORT,
net_ease_anonymous_token,
}
7 changes: 5 additions & 2 deletions src/providers/netease/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,20 @@ export const request = async (method, url, data = {}, options) => {
headers['X-Forwarded-For'] = ip
}
// headers['X-Real-IP'] = '118.88.88.88'
if (typeof options.cookie === "undefined")
options.cookie = {}

if (typeof options.cookie === 'object') {
options.cookie = {
...options.cookie,
__remember_me: true,
NMTID: nanoid(),
// NMTID: nanoid(),
_ntes_nuid: nanoid(),
}
if (!options.cookie.MUSIC_U) {
// 游客
if (!options.cookie.MUSIC_A) {
options.cookie.MUSIC_A = config.anonymous_token
options.cookie.MUSIC_A = config.net_ease_anonymous_token
}
}
headers['Cookie'] = Object.keys(options.cookie)
Expand Down

1 comment on commit cbc4270

@vercel
Copy link

@vercel vercel bot commented on cbc4270 Sep 8, 2023

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.