Skip to content

Commit

Permalink
fix dfsid precision error nondanee#74 nondanee#76
Browse files Browse the repository at this point in the history
  • Loading branch information
nondanee committed May 5, 2019
1 parent e23c185 commit 21cfd3f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions provider/netease.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ const search = info => {
'http://music.163.com/api/album/' + info.album.id

return request('GET', url)
.then(response => response.json())
.then(jsonBody => {
.then(response => response.body())
.then(body => {
let jsonBody = JSON.parse(body.replace(/"dfsId":(\d+)/g, '"dfsId":"$1"')) // for js precision
let matched = jsonBody.album.songs.find(song => song.id === info.id)
if(matched)
return matched.hMusic.dfsId || matched.mMusic.dfsId || matched.lMusic.dfsId
Expand All @@ -18,7 +19,7 @@ const search = info => {
}

const track = id => {
if(!id) return Promise.reject()
if(!id || id === '0') return Promise.reject()
let songUrl = crypto.reverse.url(id)
return songUrl
}
Expand Down

0 comments on commit 21cfd3f

Please sign in to comment.