diff --git a/README.md b/README.md index 751044c1..0a1e808a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -Listen 1 (Chrome Extension) V2.7.2 +Listen 1 (Chrome Extension) V2.8.0 ========== -(最后更新于2020年04月30日) +(最后更新于2020年06月28日) [](LICENSE) @@ -55,6 +55,9 @@ Firefox打包安装 更新日志 ------- +`2020-06-28` +* 修复网易歌单仅显示10首歌曲的问题 + `2020-04-30` * 修复咪咕音质较差的问题 diff --git a/README_EN.md b/README_EN.md index 98cd19f0..6f3b3f35 100644 --- a/README_EN.md +++ b/README_EN.md @@ -1,6 +1,6 @@ -Listen 1 (Chrome Extension) V2.7.2 +Listen 1 (Chrome Extension) V2.8.0 ========== -(Last Update April 27th, 2020) +(Last Update June 28th, 2020) [](LICENSE) @@ -42,6 +42,9 @@ Install (Firefox) Changelog ------- +`2020-06-28` +* fix netease music only show 10 tracks bug + `2020-04-30` * fix migu poor music quality bug diff --git a/js/provider/netease.js b/js/provider/netease.js index c09697ae..07d68ef4 100644 --- a/js/provider/netease.js +++ b/js/provider/netease.js @@ -160,6 +160,83 @@ function build_netease() { }); } + function async_process_list(data_list, handler, handler_extra_param_list, callback) { + const fnDict = {}; + data_list.forEach((item, index) => { + fnDict[index] = cb => handler(index, item, handler_extra_param_list, cb); + }); + async.parallel(fnDict, + (err, results) => callback(null, data_list.map((item, index) => results[index]))); + } + + function ng_render_playlist_result_item(index, item, params, callback) { + const hm = params[0]; + const se = params[1]; + const target_url = 'https://music.163.com/weapi/v3/song/detail'; + const queryIds = [item.id, item.id]; + const d = { + c: '[' + queryIds.map(id => ('{"id":' + id + '}')).join(',') + ']', + ids: '[' + queryIds.join(',') + ']' + } + const data = _encrypted_request(d); + hm({ + url: target_url, + method: 'POST', + data: se(data), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }).then((response)=>{ + track_json = response.data.songs[0]; + const track = { + id: `netrack_${track_json.id}`, + title: track_json.name, + artist: track_json.ar[0].name, + artist_id: `neartist_${track_json.ar[0].id}`, + album: track_json.al.name, + album_id: `nealbum_${track_json.al.id}`, + source: 'netease', + source_url: `http://music.163.com/#/song?id=${track_json.id}`, + img_url: track_json.al.picUrl, + url: `netrack_${track_json.id}`, + }; + return callback(null, track); + }); + } + + function ng_parse_playlist_tracks(playlist_tracks, hm, se, callback) { + const target_url = 'https://music.163.com/weapi/v3/song/detail'; + const track_ids = playlist_tracks.map(i=>i.id); + const d = { + c: '[' + track_ids.map(id => ('{"id":' + id + '}')).join(',') + ']', + ids: '[' + track_ids.join(',') + ']' + } + const data = _encrypted_request(d); + hm({ + url: target_url, + method: 'POST', + data: se(data), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }).then((response)=>{ + const tracks = response.data.songs.map(track_json=>({ + id: `netrack_${track_json.id}`, + title: track_json.name, + artist: track_json.ar[0].name, + artist_id: `neartist_${track_json.ar[0].id}`, + album: track_json.al.name, + album_id: `nealbum_${track_json.al.id}`, + source: 'netease', + source_url: `http://music.163.com/#/song?id=${track_json.id}`, + img_url: track_json.al.picUrl, + url: `netrack_${track_json.id}`, + })); + + return callback(null, tracks); + }); + } + function ne_get_playlist(url, hm, se) { // special thanks for @Binaryify // https://github.com/Binaryify/NeteaseCloudMusicApi @@ -192,22 +269,21 @@ function build_netease() { title: res_data.playlist.name, source_url: `http://music.163.com/#/playlist?id=${list_id}`, }; - const tracks = res_data.playlist.tracks.map(track_json => ({ - id: `netrack_${track_json.id}`, - title: track_json.name, - artist: track_json.ar[0].name, - artist_id: `neartist_${track_json.ar[0].id}`, - album: track_json.al.name, - album_id: `nealbum_${track_json.al.id}`, - source: 'netease', - source_url: `http://music.163.com/#/song?id=${track_json.id}`, - img_url: track_json.al.picUrl, - url: `netrack_${track_json.id}`, - })); - return fn({ - info, + + // request all tracks to fetch song info + ng_parse_playlist_tracks(res_data.playlist.trackIds, hm, se, + (err, tracks) => fn({ tracks, - }); + info, + })); + + // request every tracks to fetch song info + // async_process_list(res_data.playlist.trackIds, ng_render_playlist_result_item, [hm, se], + // (err, tracks) => fn({ + // tracks, + // info, + // })); + }); }); }, diff --git a/listen1.html b/listen1.html index b15c7359..86eeeb92 100644 --- a/listen1.html +++ b/listen1.html @@ -346,7 +346,7 @@
Listen 1 {{_HOMEPAGE}}: http://listen1.github.io/listen1/
Listen 1 {{_EMAIL}}: githublisten1@gmail.com
{{_DESIGNER}}: iparanoid
-{{_VERSION}}: 2.7.2 {{_LICENSE_NOTICE}}
+{{_VERSION}}: 2.8.0 {{_LICENSE_NOTICE}}
diff --git a/manifest.json b/manifest.json index add189de..6db6f90a 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "manifest_version": 2, "name": "Listen 1", "permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "cookies", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://*.kugou.com/", "*://*.kuwo.cn/", "*://*.bilibili.com/*", "*://*.migu.cn/*", "*://api.github.com/*", "*://github.com/*", "*://gist.githubusercontent.com/*", "webRequest", "webRequestBlocking"], - "version": "2.7.2", + "version": "2.8.0", "web_accessible_resources": [ "images/*" ], "commands": { "play_next": { diff --git a/manifest_firefox.json b/manifest_firefox.json index 1c4b8eec..6c17a323 100644 --- a/manifest_firefox.json +++ b/manifest_firefox.json @@ -21,7 +21,7 @@ "manifest_version": 2, "name": "Listen 1", "permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "cookies", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://*.kugou.com/", "*://*.kuwo.cn/", "*://*.bilibili.com/*", "*://*.migu.cn/*", "*://api.github.com/*", "*://github.com/*", "*://gist.githubusercontent.com/*", "webRequest", "webRequestBlocking"], - "version": "2.7.2", + "version": "2.8.0", "web_accessible_resources": [ "images/*" ], "content_scripts": [{ "matches": ["https://listen1.github.io/listen1/*"], diff --git a/package.json b/package.json index 9e290fc8..abcfbdab 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "listen1_chrome_extension", - "version": "2.1.1", - "description": "Listen 1 (Chrome Extension) V2.1.1 ========== (最后更新于2018年12月24日)", + "version": "2.8.0", + "description": "one for all free music in china", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"