Skip to content

Commit

Permalink
avoid ncm encryption, skip local music payment check #44
Browse files Browse the repository at this point in the history
  • Loading branch information
nondanee committed Feb 24, 2019
1 parent 73341fb commit cffa03f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,9 @@ hook.http.after = ctx => {
netease.encrypted = true
netease.jsonBody = JSON.parse(crypto.eapi.decrypt(buffer).toString())
}

if(netease.path.includes('manipulate') && netease.jsonBody.code == 401)
if(netease.path.includes('manipulate') && [401, 512].includes(netease.jsonBody.code))
return tryCollect(ctx)
else if(netease.path == '/api/song/like' && netease.jsonBody.code == 401)
else if(netease.path == '/api/song/like' && [401, 512].includes(netease.jsonBody.code))
return tryLike(ctx)
else if(netease.path.includes('url'))
return tryMatch(ctx)
Expand All @@ -133,6 +132,8 @@ hook.http.after = ctx => {
value['pic'] = value['pic_str']
if('coverImgId_str' in value && 'coverImgId' in value) // for js precision
value['coverImgId'] = value['coverImgId_str']
if('fee' in value) value['fee'] = 0
if('cp' in value) value['cp'] = 0
if('st' in value && 'pl' in value && 'dl' in value && 'subp' in value){ // batch modify
value['st'] = 0
value['subp'] = 1
Expand Down Expand Up @@ -221,6 +222,7 @@ const tryMatch = ctx => {
let tasks = [], target = 0

const inject = item => {
item.flag = 0
if(item.code != 200 && (target == 0 || item.id == target)){
return match(item.id)
.then(song => {
Expand Down

0 comments on commit cffa03f

Please sign in to comment.