From 9bd30a0ffb7d1737562269992ee4f0784583915d Mon Sep 17 00:00:00 2001 From: a632079 Date: Wed, 5 Aug 2020 02:07:37 +0800 Subject: [PATCH 1/2] feat: realIP option --- .gitignore | 1 + module/activate_init_profile.js | 11 +++-- module/album.js | 13 ++++-- module/album_detail.js | 9 ++-- module/album_detail_dynamic.js | 9 +++- module/album_list.js | 15 ++++-- module/album_list_style.js | 13 ++++-- module/album_new.js | 14 +++--- module/album_newest.js | 11 ++++- module/album_songsaleboard.js | 7 ++- module/album_sub.js | 13 +++--- module/album_sublist.js | 14 +++--- module/artist_album.js | 15 ++++-- module/artist_desc.js | 15 ++++-- module/artist_list.js | 18 +++++--- module/artist_mv.js | 14 +++--- module/artist_sub.js | 17 +++++-- module/artist_sublist.js | 14 +++--- module/artist_top_song.js | 14 +++--- module/artists.js | 13 ++++-- module/avatar_upload.js | 9 +++- module/banner.js | 21 +++++---- module/batch.js | 19 ++++---- module/captcha_sent.js | 12 ++--- module/captcha_verify.js | 9 +++- module/cellphone_existence_check.js | 11 +++-- module/check_music.js | 47 ++++++++++--------- module/comment.js | 29 +++++++----- module/comment_album.js | 15 ++++-- module/comment_dj.js | 15 ++++-- module/comment_event.js | 15 ++++-- module/comment_hot.js | 17 +++++-- module/comment_hotwall_list.js | 7 ++- module/comment_like.js | 21 ++++++--- module/comment_music.js | 17 ++++--- module/comment_mv.js | 15 ++++-- module/comment_playlist.js | 15 ++++-- module/comment_video.js | 15 ++++-- module/countries_code_list.js | 9 ++-- module/daily_signin.js | 14 +++--- module/digitalAlbum_ordering.js | 27 +++++++---- module/digitalAlbum_purchased.js | 15 ++++-- module/dj_banner.js | 15 ++++-- module/dj_category_excludehot.js | 14 ++++-- module/dj_category_recommend.js | 14 ++++-- module/dj_catelist.js | 13 ++++-- module/dj_detail.js | 14 +++--- module/dj_hot.js | 14 +++--- module/dj_paygift.js | 15 ++++-- module/dj_program.js | 9 +++- module/dj_program_detail.js | 15 ++++-- module/dj_program_toplist.js | 14 +++--- module/dj_program_toplist_hours.js | 15 ++++-- module/dj_radio_hot.js | 14 +++--- module/dj_recommend.js | 11 ++++- module/dj_recommend_type.js | 15 ++++-- module/dj_sub.js | 17 +++++-- module/dj_sublist.js | 15 ++++-- module/dj_today_perfered.js | 17 +++++-- module/dj_toplist.js | 18 ++++---- module/dj_toplist_hours.js | 14 +++--- module/dj_toplist_newcomer.js | 15 ++++-- module/dj_toplist_pay.js | 15 ++++-- module/dj_toplist_popular.js | 14 +++--- module/event.js | 16 ++++--- module/event_del.js | 12 +++-- module/event_forward.js | 13 +++--- module/fm_trash.js | 17 +++++-- module/follow.js | 15 ++++-- module/history_recommend_songs.js | 16 +++++-- module/history_recommend_songs_detail.js | 13 ++++-- module/homepage_block_page.js | 17 +++++-- module/homepage_dragon_ball.js | 11 +++-- module/hot_topic.js | 14 +++--- module/like.js | 15 ++++-- module/likelist.js | 14 +++--- module/login.js | 32 ++++++++----- module/login_cellphone.js | 24 +++++++--- module/login_refresh.js | 14 ++++-- module/login_status.js | 34 +++++++------- module/logout.js | 14 ++++-- module/lyric.js | 16 +++---- module/msg_comments.js | 13 +++--- module/msg_forwards.js | 11 +++-- module/msg_notices.js | 11 +++-- module/msg_private.js | 9 ++-- module/msg_private_history.js | 11 +++-- module/mv_all.js | 13 +++--- module/mv_detail.js | 14 +++--- module/mv_detail_info.js | 17 +++++-- module/mv_exclusive_rcmd.js | 11 +++-- module/mv_first.js | 22 +++++---- module/mv_sub.js | 18 ++++---- module/mv_sublist.js | 15 ++++-- module/mv_url.js | 15 ++++-- module/personal_fm.js | 13 ++++-- module/personalized.js | 15 ++++-- module/personalized_djprogram.js | 13 ++++-- module/personalized_mv.js | 13 ++++-- module/personalized_newsong.js | 15 ++++-- module/personalized_privatecontent.js | 13 ++++-- module/personalized_privatecontent_list.js | 10 +++- module/playlist_catlist.js | 13 ++++-- module/playlist_cover_update.js | 9 +++- module/playlist_create.js | 13 +++--- module/playlist_delete.js | 13 +++--- module/playlist_desc_update.js | 11 +++-- module/playlist_detail.js | 15 ++++-- module/playlist_hot.js | 13 ++++-- module/playlist_name_update.js | 11 +++-- module/playlist_order_update.js | 15 ++++-- module/playlist_subscribe.js | 17 +++++-- module/playlist_subscribers.js | 15 ++++-- module/playlist_tags_update.js | 11 +++-- module/playlist_tracks.js | 15 ++++-- module/playlist_update.js | 14 +++--- module/playmode_intelligence_list.js | 15 ++++-- module/program_recommend.js | 15 ++++-- module/rebind.js | 15 ++++-- module/recommend_resource.js | 13 ++++-- module/recommend_songs.js | 16 +++++-- module/register_cellphone.js | 11 +++-- module/related_allvideo.js | 15 ++++-- module/related_playlist.js | 53 +++++++++++----------- module/resource_like.js | 23 ++++++---- module/scrobble.js | 38 +++++++++------- module/search.js | 14 +++--- module/search_default.js | 8 ++-- module/search_hot.js | 15 +++--- module/search_hot_detail.js | 14 ++++-- module/search_multimatch.js | 15 ++++-- module/search_suggest.js | 15 ++++-- module/send_playlist.js | 14 +++--- module/send_text.js | 14 +++--- module/setting.js | 16 +++---- module/share_resource.js | 15 ++++-- module/simi_artist.js | 15 ++++-- module/simi_mv.js | 14 +++--- module/simi_playlist.js | 15 ++++-- module/simi_song.js | 15 ++++-- module/simi_user.js | 15 ++++-- module/song_detail.js | 16 ++++--- module/song_order_update.js | 9 ++-- module/song_url.js | 18 ++++++-- module/top_album.js | 13 ++++-- module/top_artists.js | 14 +++--- module/top_list.js | 23 ++++++---- module/top_mv.js | 11 +++-- module/top_playlist.js | 14 +++--- module/top_playlist_highquality.js | 15 ++++-- module/top_song.js | 9 +++- module/toplist.js | 13 ++++-- module/toplist_artist.js | 14 +++--- module/toplist_detail.js | 13 ++++-- module/user_audio.js | 15 ++++-- module/user_cloud.js | 14 +++--- module/user_cloud_del.js | 11 +++-- module/user_cloud_detail.js | 17 ++++--- module/user_detail.js | 13 ++++-- module/user_dj.js | 15 ++++-- module/user_event.js | 15 ++++-- module/user_followeds.js | 11 +++-- module/user_follows.js | 15 ++++-- module/user_playlist.js | 14 +++--- module/user_record.js | 14 +++--- module/user_subcount.js | 13 ++++-- module/user_update.js | 15 ++++-- module/video_category_list.js | 10 ++-- module/video_detail.js | 15 ++++-- module/video_detail_info.js | 17 +++++-- module/video_group.js | 10 ++-- module/video_group_list.js | 11 ++--- module/video_sub.js | 17 +++++-- module/video_timeline_all.js | 10 ++-- module/video_timeline_recommend.js | 23 ++++------ module/video_url.js | 15 ++++-- module/weblog.js | 13 ++++-- util/request.js | 2 + 178 files changed, 1734 insertions(+), 906 deletions(-) diff --git a/.gitignore b/.gitignore index 39c7fa3410f..1083a12c1f2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ node_modules .idea/ package-lock.json +yarn.lock .vscode \ No newline at end of file diff --git a/module/activate_init_profile.js b/module/activate_init_profile.js index c9b5c3a276b..a83657096c0 100644 --- a/module/activate_init_profile.js +++ b/module/activate_init_profile.js @@ -2,8 +2,8 @@ module.exports = (query, request) => { const data = { - nickname: query.nickname - }; + nickname: query.nickname, + } return request( 'POST', `http://music.163.com/eapi/activate/initProfile`, @@ -12,7 +12,8 @@ module.exports = (query, request) => { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/activate/initProfile' + realIP: query.realIP, + url: '/api/activate/initProfile', } - ); -}; + ) +} diff --git a/module/album.js b/module/album.js index 213d92a2774..318e50ee282 100644 --- a/module/album.js +++ b/module/album.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/v1/album/${query.id}`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/album/${query.id}`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/album_detail.js b/module/album_detail.js index 053cd62f19c..d499b13ef1a 100644 --- a/module/album_detail.js +++ b/module/album_detail.js @@ -1,14 +1,17 @@ // 数字专辑详情 module.exports = (query, request) => { const data = { - id: query.id + id: query.id, } return request( - 'POST', `https://music.163.com/weapi/vipmall/albumproduct/detail`, data, + 'POST', + `https://music.163.com/weapi/vipmall/albumproduct/detail`, + data, { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy, + realIP: query.realIP, } ) -} \ No newline at end of file +} diff --git a/module/album_detail_dynamic.js b/module/album_detail_dynamic.js index a48386a78c5..ede2f00a571 100644 --- a/module/album_detail_dynamic.js +++ b/module/album_detail_dynamic.js @@ -1,12 +1,17 @@ // 专辑动态信息 module.exports = (query, request) => { const data = { - id: query.id + id: query.id, } return request( 'POST', `https://music.163.com/api/album/detail/dynamic`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/album_list.js b/module/album_list.js index a2d998cc5c1..3f44174dbe2 100644 --- a/module/album_list.js +++ b/module/album_list.js @@ -5,10 +5,17 @@ module.exports = (query, request) => { offset: query.offset || 0, total: true, area: query.area || 'ALL', //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本 - type: query.type + type: query.type, } return request( - 'POST', `https://music.163.com/weapi/vipmall/albumproduct/list`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/vipmall/albumproduct/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/album_list_style.js b/module/album_list_style.js index 6bd7a39b8d0..00340581338 100644 --- a/module/album_list_style.js +++ b/module/album_list_style.js @@ -7,7 +7,14 @@ module.exports = (query, request) => { area: query.area || 'Z_H', //Z_H:华语,E_A:欧美,KR:韩国,JP:日本 } return request( - 'POST', `https://music.163.com/weapi/vipmall/appalbum/album/style`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/vipmall/appalbum/album/style`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/album_new.js b/module/album_new.js index 5889a2a122a..b4652d3ea3b 100644 --- a/module/album_new.js +++ b/module/album_new.js @@ -4,10 +4,12 @@ module.exports = (query, request) => { limit: query.limit || 30, offset: query.offset || 0, total: true, - area: query.area || 'ALL' //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本 + area: query.area || 'ALL', //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本 } - return request( - 'POST', `https://music.163.com/weapi/album/new`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/album/new`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/album_newest.js b/module/album_newest.js index 64742bb67da..cf94660f8d1 100644 --- a/module/album_newest.js +++ b/module/album_newest.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/api/discovery/newAlbum`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/discovery/newAlbum`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/album_songsaleboard.js b/module/album_songsaleboard.js index f761ab006d3..ec8efb47ec7 100644 --- a/module/album_songsaleboard.js +++ b/module/album_songsaleboard.js @@ -14,6 +14,11 @@ module.exports = (query, request) => { 'POST', `https://music.163.com/api/feealbum/songsaleboard/${type}/type`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/album_sub.js b/module/album_sub.js index f213bbb3934..65c6b245597 100644 --- a/module/album_sub.js +++ b/module/album_sub.js @@ -1,13 +1,14 @@ // 收藏/取消收藏专辑 module.exports = (query, request) => { - query.t = (query.t == 1 ? 'sub' : 'unsub') + query.t = query.t == 1 ? 'sub' : 'unsub' const data = { - id: query.id - }; + id: query.id, + } return request('POST', `https://music.163.com/api/album/${query.t}`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/album_sublist.js b/module/album_sublist.js index d129ae67349..5d01578a1fa 100644 --- a/module/album_sublist.js +++ b/module/album_sublist.js @@ -4,10 +4,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 25, offset: query.offset || 0, - total: true + total: true, } - return request( - 'POST', `https://music.163.com/weapi/album/sublist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/album/sublist`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/artist_album.js b/module/artist_album.js index 50575f4643e..cafe2ed1727 100644 --- a/module/artist_album.js +++ b/module/artist_album.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, offset: query.offset || 0, - total: true + total: true, } return request( - 'POST', `https://music.163.com/weapi/artist/albums/${query.id}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/artist/albums/${query.id}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/artist_desc.js b/module/artist_desc.js index b209b3373ee..9237dc4cfc4 100644 --- a/module/artist_desc.js +++ b/module/artist_desc.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { - id: query.id + id: query.id, } return request( - 'POST', `https://music.163.com/weapi/artist/introduction`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/artist/introduction`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/artist_list.js b/module/artist_list.js index b7b6ba5fc2a..fe95864ef0b 100644 --- a/module/artist_list.js +++ b/module/artist_list.js @@ -19,15 +19,19 @@ module.exports = (query, request) => { const data = { - initial: isNaN(query.initial) ? (query.initial || '').toUpperCase().charCodeAt() || undefined : query.initial, + initial: isNaN(query.initial) + ? (query.initial || '').toUpperCase().charCodeAt() || undefined + : query.initial, offset: query.offset || 0, limit: query.limit || 30, total: true, type: query.type || '1', - area: query.area + area: query.area, } - return request( - 'POST', `https://music.163.com/api/v1/artist/list`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/v1/artist/list`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/artist_mv.js b/module/artist_mv.js index 5c64156a570..8decc043700 100644 --- a/module/artist_mv.js +++ b/module/artist_mv.js @@ -5,10 +5,12 @@ module.exports = (query, request) => { artistId: query.id, limit: query.limit, offset: query.offset, - total: true + total: true, } - return request( - 'POST', `https://music.163.com/weapi/artist/mvs`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/artist/mvs`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/artist_sub.js b/module/artist_sub.js index 4d9115df964..4e9eebef221 100644 --- a/module/artist_sub.js +++ b/module/artist_sub.js @@ -1,13 +1,20 @@ // 收藏与取消收藏歌手 module.exports = (query, request) => { - query.t = (query.t == 1 ? 'sub' : 'unsub') + query.t = query.t == 1 ? 'sub' : 'unsub' const data = { artistId: query.id, - artistIds: '[' + query.id + ']' + artistIds: '[' + query.id + ']', } return request( - 'POST', `https://music.163.com/weapi/artist/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/artist/${query.t}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/artist_sublist.js b/module/artist_sublist.js index e83405ab061..c4adf408c27 100644 --- a/module/artist_sublist.js +++ b/module/artist_sublist.js @@ -4,10 +4,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 25, offset: query.offset || 0, - total: true + total: true, } - return request( - 'POST', `https://music.163.com/weapi/artist/sublist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/artist/sublist`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/artist_top_song.js b/module/artist_top_song.js index 5db32557b91..c86136e6758 100644 --- a/module/artist_top_song.js +++ b/module/artist_top_song.js @@ -1,10 +1,12 @@ // 歌手热门 50 首歌曲 module.exports = (query, request) => { const data = { - id: query.id + id: query.id, } - return request( - 'POST', `https://music.163.com/api/artist/top/song`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/artist/top/song`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/artists.js b/module/artists.js index 34ce5b7cc69..2e09262ab4c 100644 --- a/module/artists.js +++ b/module/artists.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/v1/artist/${query.id}`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/artist/${query.id}`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/avatar_upload.js b/module/avatar_upload.js index 2f5d603bf17..7b2ea18d167 100644 --- a/module/avatar_upload.js +++ b/module/avatar_upload.js @@ -5,9 +5,14 @@ module.exports = async (query, request) => { 'POST', `https://music.163.com/weapi/user/avatar/upload/v1`, { - imgid: uploadInfo.imgId + imgid: uploadInfo.imgId, }, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) return { status: 200, diff --git a/module/banner.js b/module/banner.js index 63a69d651ae..4e748f5091f 100644 --- a/module/banner.js +++ b/module/banner.js @@ -1,14 +1,17 @@ // 首页轮播图 module.exports = (query, request) => { - const type = { - 0: 'pc', - 1: 'android', - 2: 'iphone', - 3: 'ipad' - }[query.type || 0] || 'pc'; + const type = + { + 0: 'pc', + 1: 'android', + 2: 'iphone', + 3: 'ipad', + }[query.type || 0] || 'pc' return request( - 'POST', `https://music.163.com/api/v2/banner/get`, {clientType: type}, - {crypto: 'linuxapi', proxy: query.proxy} + 'POST', + `https://music.163.com/api/v2/banner/get`, + { clientType: type }, + { crypto: 'linuxapi', proxy: query.proxy, realIP: query.realIP } ) -} \ No newline at end of file +} diff --git a/module/batch.js b/module/batch.js index 641181e3003..a55252f1c1e 100644 --- a/module/batch.js +++ b/module/batch.js @@ -2,15 +2,18 @@ module.exports = (query, request) => { const data = { - 'e_r': true - }; - Object.keys(query).forEach(i => { + e_r: true, + } + Object.keys(query).forEach((i) => { if (/^\/api\//.test(i)) { data[i] = query[i] } }) - return request( - 'POST', `http://music.163.com/eapi/batch`, data, - {crypto: 'eapi', proxy: query.proxy, url: '/api/batch', cookie: query.cookie} - ) -}; \ No newline at end of file + return request('POST', `http://music.163.com/eapi/batch`, data, { + crypto: 'eapi', + proxy: query.proxy, + url: '/api/batch', + cookie: query.cookie, + realIP: query.realIP, + }) +} diff --git a/module/captcha_sent.js b/module/captcha_sent.js index 05d1c6a2104..ef7b3af771b 100644 --- a/module/captcha_sent.js +++ b/module/captcha_sent.js @@ -5,10 +5,10 @@ module.exports = (query, request) => { ctcode: query.ctcode || '86', cellphone: query.phone, } - return request( - 'POST', - `https://music.163.com/weapi/sms/captcha/sent`, - data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ) + return request('POST', `https://music.163.com/weapi/sms/captcha/sent`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) } diff --git a/module/captcha_verify.js b/module/captcha_verify.js index 0abe38805d5..472b9d21e63 100644 --- a/module/captcha_verify.js +++ b/module/captcha_verify.js @@ -4,12 +4,17 @@ module.exports = (query, request) => { const data = { ctcode: query.ctcode || '86', cellphone: query.phone, - captcha: query.captcha + captcha: query.captcha, } return request( 'POST', `https://music.163.com/weapi/sms/captcha/verify`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/cellphone_existence_check.js b/module/cellphone_existence_check.js index 229391c21e5..c79d03eb0e5 100644 --- a/module/cellphone_existence_check.js +++ b/module/cellphone_existence_check.js @@ -3,8 +3,8 @@ module.exports = (query, request) => { const data = { cellphone: query.phone, - countrycode: query.countrycode - }; + countrycode: query.countrycode, + } return request( 'POST', `http://music.163.com/eapi/cellphone/existence/check`, @@ -13,7 +13,8 @@ module.exports = (query, request) => { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/cellphone/existence/check' + url: '/api/cellphone/existence/check', + realIP: query.realIP, } - ); -}; + ) +} diff --git a/module/check_music.js b/module/check_music.js index 69f70d66907..1c750b12c97 100644 --- a/module/check_music.js +++ b/module/check_music.js @@ -3,27 +3,32 @@ module.exports = (query, request) => { const data = { ids: '[' + parseInt(query.id) + ']', - br: parseInt(query.br || 999000) + br: parseInt(query.br || 999000), } return request( - 'POST', `https://music.163.com/weapi/song/enhance/player/url`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) - .then(response => { - let playable = false - if(response.body.code == 200){ - if(response.body.data[0].code == 200){ - playable = true - } + 'POST', + `https://music.163.com/weapi/song/enhance/player/url`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ).then((response) => { + let playable = false + if (response.body.code == 200) { + if (response.body.data[0].code == 200) { + playable = true } - if(playable){ - response.body = {success: true, message: 'ok'} - return response - } - else{ - response.status = 404 - response.body = {success: false, message: '亲爱的,暂无版权'} - return Promise.reject(response) - } - }) -} \ No newline at end of file + } + if (playable) { + response.body = { success: true, message: 'ok' } + return response + } else { + response.status = 404 + response.body = { success: false, message: '亲爱的,暂无版权' } + return Promise.reject(response) + } + }) +} diff --git a/module/comment.js b/module/comment.js index dc1bb330929..39cbf874523 100644 --- a/module/comment.js +++ b/module/comment.js @@ -5,7 +5,7 @@ module.exports = (query, request) => { query.t = { 1: 'add', 0: 'delete', - 2: 'reply' + 2: 'reply', }[query.t] query.type = { 0: 'R_SO_4_', // 歌曲 @@ -14,25 +14,30 @@ module.exports = (query, request) => { 3: 'R_AL_3_', // 专辑 4: 'A_DJ_1_', // 电台, 5: 'R_VI_62_', // 视频 - 6: 'A_EV_2_' // 动态 + 6: 'A_EV_2_', // 动态 }[query.type] const data = { - threadId: query.type + query.id + threadId: query.type + query.id, } - - if(query.type == 'A_EV_2_'){ + + if (query.type == 'A_EV_2_') { data.threadId = query.threadId } - if(query.t == 'add') - data.content = query.content - else if(query.t == 'delete') - data.commentId = query.commentId + if (query.t == 'add') data.content = query.content + else if (query.t == 'delete') data.commentId = query.commentId else if (query.t == 'reply') { data.commentId = query.commentId data.content = query.content } return request( - 'POST', `https://music.163.com/weapi/resource/comments/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/resource/comments/${query.t}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/comment_album.js b/module/comment_album.js index 75d00c94a36..dbc42069b2e 100644 --- a/module/comment_album.js +++ b/module/comment_album.js @@ -6,10 +6,17 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 + beforeTime: query.before || 0, } return request( - 'POST', `https://music.163.com/weapi/v1/resource/comments/R_AL_3_${query.id}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/resource/comments/R_AL_3_${query.id}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/comment_dj.js b/module/comment_dj.js index cfb99e1fe4b..752588b62a1 100644 --- a/module/comment_dj.js +++ b/module/comment_dj.js @@ -6,10 +6,17 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 + beforeTime: query.before || 0, } return request( - 'POST', `https://music.163.com/weapi/v1/resource/comments/A_DJ_1_${query.id}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/resource/comments/A_DJ_1_${query.id}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/comment_event.js b/module/comment_event.js index 517ece98367..632056de2ce 100644 --- a/module/comment_event.js +++ b/module/comment_event.js @@ -4,12 +4,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 - }; + beforeTime: query.before || 0, + } return request( 'POST', `https://music.163.com/weapi/v1/resource/comments/${query.threadId}`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/comment_hot.js b/module/comment_hot.js index f2bfe0d0c98..5c8c33ad101 100644 --- a/module/comment_hot.js +++ b/module/comment_hot.js @@ -8,16 +8,23 @@ module.exports = (query, request) => { 2: 'A_PL_0_', // 歌单 3: 'R_AL_3_', // 专辑 4: 'A_DJ_1_', // 电台, - 5: 'R_VI_62_' // 视频 + 5: 'R_VI_62_', // 视频 }[query.type] const data = { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 + beforeTime: query.before || 0, } return request( - 'POST', `https://music.163.com/weapi/v1/resource/hotcomments/${query.type}${query.id}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/resource/hotcomments/${query.type}${query.id}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/comment_hotwall_list.js b/module/comment_hotwall_list.js index f0072fd0e11..f4d4a12dc0b 100644 --- a/module/comment_hotwall_list.js +++ b/module/comment_hotwall_list.js @@ -6,6 +6,11 @@ module.exports = (query, request) => { 'POST', `https://music.163.com/api/comment/hotwall/list/get`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/comment_like.js b/module/comment_like.js index 983f324f8f7..89fc8c13048 100644 --- a/module/comment_like.js +++ b/module/comment_like.js @@ -2,7 +2,7 @@ module.exports = (query, request) => { query.cookie.os = 'pc' - query.t = (query.t == 1 ? 'like' : 'unlike') + query.t = query.t == 1 ? 'like' : 'unlike' query.type = { 0: 'R_SO_4_', // 歌曲 1: 'R_MV_5_', // MV @@ -10,17 +10,24 @@ module.exports = (query, request) => { 3: 'R_AL_3_', // 专辑 4: 'A_DJ_1_', // 电台, 5: 'R_VI_62_', // 视频 - 6: 'A_EV_2_' // 动态 + 6: 'A_EV_2_', // 动态 }[query.type] const data = { threadId: query.type + query.id, - commentId: query.cid + commentId: query.cid, } - if(query.type == 'A_EV_2_'){ + if (query.type == 'A_EV_2_') { data.threadId = query.threadId } return request( - 'POST', `https://music.163.com/weapi/v1/comment/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/comment/${query.t}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/comment_music.js b/module/comment_music.js index 6c8308670d9..ee6f3a9a3c9 100644 --- a/module/comment_music.js +++ b/module/comment_music.js @@ -1,17 +1,22 @@ // 歌曲评论 module.exports = (query, request) => { - query.cookie.os = 'pc'; + query.cookie.os = 'pc' const data = { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 - }; + beforeTime: query.before || 0, + } return request( 'POST', `https://music.163.com/api/v1/resource/comments/R_SO_4_${query.id}`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/comment_mv.js b/module/comment_mv.js index d6c0b76a4d2..d20681ceed3 100644 --- a/module/comment_mv.js +++ b/module/comment_mv.js @@ -6,10 +6,17 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 + beforeTime: query.before || 0, } return request( - 'POST', `https://music.163.com/weapi/v1/resource/comments/R_MV_5_${query.id}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/resource/comments/R_MV_5_${query.id}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/comment_playlist.js b/module/comment_playlist.js index e0ef723915d..7bdc27f6a8e 100644 --- a/module/comment_playlist.js +++ b/module/comment_playlist.js @@ -6,10 +6,17 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 + beforeTime: query.before || 0, } return request( - 'POST', `https://music.163.com/weapi/v1/resource/comments/A_PL_0_${query.id}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/resource/comments/A_PL_0_${query.id}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/comment_video.js b/module/comment_video.js index 452f1373cc0..d89d4d4a078 100644 --- a/module/comment_video.js +++ b/module/comment_video.js @@ -6,10 +6,17 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before || 0 + beforeTime: query.before || 0, } return request( - 'POST', `https://music.163.com/weapi/v1/resource/comments/R_VI_62_${query.id}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/resource/comments/R_VI_62_${query.id}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/countries_code_list.js b/module/countries_code_list.js index 3adf40ff3df..32d88523763 100644 --- a/module/countries_code_list.js +++ b/module/countries_code_list.js @@ -2,12 +2,15 @@ module.exports = (query, request) => { const data = {} return request( - 'POST', `http://interface3.music.163.com/eapi/lbs/countries/v1`, data, + 'POST', + `http://interface3.music.163.com/eapi/lbs/countries/v1`, + data, { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/lbs/countries/v1' + url: '/api/lbs/countries/v1', + realIP: query.realIP, } ) -} \ No newline at end of file +} diff --git a/module/daily_signin.js b/module/daily_signin.js index 10c34038b68..2bb7deef7f3 100644 --- a/module/daily_signin.js +++ b/module/daily_signin.js @@ -9,10 +9,12 @@ module.exports = (query, request) => { const data = { - type: query.type || 0 + type: query.type || 0, } - return request( - 'POST', `https://music.163.com/weapi/point/dailyTask`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/point/dailyTask`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/digitalAlbum_ordering.js b/module/digitalAlbum_ordering.js index 0820399f6f7..7c930b9a544 100644 --- a/module/digitalAlbum_ordering.js +++ b/module/digitalAlbum_ordering.js @@ -4,15 +4,24 @@ module.exports = (query, request) => { const data = { business: 'Album', paymentMethod: query.payment, - digitalResources: JSON.stringify([{ - business: 'Album', - resourceID: query.id, - quantity: query.quantity, - }]), - from: 'web' + digitalResources: JSON.stringify([ + { + business: 'Album', + resourceID: query.id, + quantity: query.quantity, + }, + ]), + from: 'web', } return request( - 'POST', `https://music.163.com/api/ordering/web/digital`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/ordering/web/digital`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/digitalAlbum_purchased.js b/module/digitalAlbum_purchased.js index 50b572c0e7b..3608f917c20 100644 --- a/module/digitalAlbum_purchased.js +++ b/module/digitalAlbum_purchased.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, offset: query.offset || 0, - total: true + total: true, } return request( - 'POST', `https://music.163.com/api/digitalAlbum/purchased`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/digitalAlbum/purchased`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_banner.js b/module/dj_banner.js index ca37c914fd2..32551feb6ce 100644 --- a/module/dj_banner.js +++ b/module/dj_banner.js @@ -1,12 +1,17 @@ // 电台banner module.exports = (query, request) => { - const data = {}; - query.cookie.os = 'pc'; + const data = {} + query.cookie.os = 'pc' return request( 'POST', `http://music.163.com/weapi/djradio/banner/get`, {}, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/dj_category_excludehot.js b/module/dj_category_excludehot.js index f184ceec072..b61c43866cb 100644 --- a/module/dj_category_excludehot.js +++ b/module/dj_category_excludehot.js @@ -1,9 +1,15 @@ // 电台非热门类型 module.exports = (query, request) => { - return request( - 'POST', `http://music.163.com/weapi/djradio/category/excludehot`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `http://music.163.com/weapi/djradio/category/excludehot`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -}; \ No newline at end of file +} diff --git a/module/dj_category_recommend.js b/module/dj_category_recommend.js index 864f3e8b57f..a45782fd269 100644 --- a/module/dj_category_recommend.js +++ b/module/dj_category_recommend.js @@ -1,9 +1,15 @@ // 电台推荐类型 module.exports = (query, request) => { - return request( - 'POST', `http://music.163.com/weapi/djradio/home/category/recommend`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `http://music.163.com/weapi/djradio/home/category/recommend`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -}; \ No newline at end of file +} diff --git a/module/dj_catelist.js b/module/dj_catelist.js index 934df2646bc..f4698fe602c 100644 --- a/module/dj_catelist.js +++ b/module/dj_catelist.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/djradio/category/get`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/djradio/category/get`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_detail.js b/module/dj_detail.js index e987699d15f..5b680c87ca4 100644 --- a/module/dj_detail.js +++ b/module/dj_detail.js @@ -2,10 +2,12 @@ module.exports = (query, request) => { const data = { - id: query.rid + id: query.rid, } - return request( - 'POST', `https://music.163.com/weapi/djradio/get`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/djradio/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/dj_hot.js b/module/dj_hot.js index c7655d8c056..5f7e30f0723 100644 --- a/module/dj_hot.js +++ b/module/dj_hot.js @@ -3,10 +3,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, - offset: query.offset || 0 + offset: query.offset || 0, } - return request( - 'POST', `https://music.163.com/weapi/djradio/hot/v1`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/djradio/hot/v1`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/dj_paygift.js b/module/dj_paygift.js index 5fc6823a8ef..96362a38ba4 100644 --- a/module/dj_paygift.js +++ b/module/dj_paygift.js @@ -3,10 +3,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, - offset: query.offset || 0 + offset: query.offset || 0, } return request( - 'POST', `https://music.163.com/weapi/djradio/home/paygift/list?_nmclfl=1`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/djradio/home/paygift/list?_nmclfl=1`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_program.js b/module/dj_program.js index a2a58d13984..a95df08f82e 100644 --- a/module/dj_program.js +++ b/module/dj_program.js @@ -5,12 +5,17 @@ module.exports = (query, request) => { radioId: query.rid, limit: query.limit || 30, offset: query.offset || 0, - asc: toBoolean(query.asc) + asc: toBoolean(query.asc), } return request( 'POST', `https://music.163.com/weapi/dj/program/byradio`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/dj_program_detail.js b/module/dj_program_detail.js index 09f9699149e..b424937b070 100644 --- a/module/dj_program_detail.js +++ b/module/dj_program_detail.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { - id: query.id + id: query.id, } return request( - 'POST', `https://music.163.com/weapi/dj/program/detail`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/dj/program/detail`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_program_toplist.js b/module/dj_program_toplist.js index 3ec08b3e57a..898cf9d1c5a 100644 --- a/module/dj_program_toplist.js +++ b/module/dj_program_toplist.js @@ -3,10 +3,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 100, - offset: query.offset || 0 + offset: query.offset || 0, } - return request( - 'POST', `https://music.163.com/api/program/toplist/v1`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/program/toplist/v1`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/dj_program_toplist_hours.js b/module/dj_program_toplist_hours.js index 7d8de24d3ae..d8bb2d73733 100644 --- a/module/dj_program_toplist_hours.js +++ b/module/dj_program_toplist_hours.js @@ -1,11 +1,18 @@ // 电台24小时节目榜 module.exports = (query, request) => { const data = { - limit: query.limit || 100 + limit: query.limit || 100, // 不支持 offset } return request( - 'POST', `https://music.163.com/api/djprogram/toplist/hours`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/djprogram/toplist/hours`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_radio_hot.js b/module/dj_radio_hot.js index d618b4777ed..30e0b42ebc2 100644 --- a/module/dj_radio_hot.js +++ b/module/dj_radio_hot.js @@ -4,10 +4,12 @@ module.exports = (query, request) => { const data = { cateId: query.cateId, limit: query.limit || 30, - offset: query.offset || 0 + offset: query.offset || 0, } - return request( - 'POST', `https://music.163.com/api/djradio/hot`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/djradio/hot`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/dj_recommend.js b/module/dj_recommend.js index 0a4536dd642..9266805e92f 100644 --- a/module/dj_recommend.js +++ b/module/dj_recommend.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/djradio/recommend/v1`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/djradio/recommend/v1`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/dj_recommend_type.js b/module/dj_recommend_type.js index c66777c01f2..0956b23a724 100644 --- a/module/dj_recommend_type.js +++ b/module/dj_recommend_type.js @@ -25,10 +25,17 @@ module.exports = (query, request) => { const data = { - cateId: query.type + cateId: query.type, } return request( - 'POST', `https://music.163.com/weapi/djradio/recommend`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/djradio/recommend`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_sub.js b/module/dj_sub.js index 0e8559a7256..f604ae40a25 100644 --- a/module/dj_sub.js +++ b/module/dj_sub.js @@ -1,12 +1,19 @@ // 订阅与取消电台 module.exports = (query, request) => { - query.t = (query.t == 1 ? 'sub' : 'unsub') + query.t = query.t == 1 ? 'sub' : 'unsub' const data = { - id: query.rid + id: query.rid, } return request( - 'POST', `https://music.163.com/weapi/djradio/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/djradio/${query.t}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_sublist.js b/module/dj_sublist.js index f1ef137ff04..91d15e2bc67 100644 --- a/module/dj_sublist.js +++ b/module/dj_sublist.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, offset: query.offset || 0, - total: true + total: true, } return request( - 'POST', `https://music.163.com/weapi/djradio/get/subed`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/djradio/get/subed`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_today_perfered.js b/module/dj_today_perfered.js index ab100264efc..78e2e950dd9 100644 --- a/module/dj_today_perfered.js +++ b/module/dj_today_perfered.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { - page: query.page || 0 - }; + page: query.page || 0, + } return request( - 'POST', `http://music.163.com/weapi/djradio/home/today/perfered`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `http://music.163.com/weapi/djradio/home/today/perfered`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -}; \ No newline at end of file +} diff --git a/module/dj_toplist.js b/module/dj_toplist.js index 92002193005..cbe04d76b53 100644 --- a/module/dj_toplist.js +++ b/module/dj_toplist.js @@ -1,16 +1,18 @@ // 新晋电台榜/热门电台榜 const typeMap = { - 'new': 0, - 'hot': 1 + new: 0, + hot: 1, } module.exports = (query, request) => { const data = { limit: query.limit || 100, offset: query.offset || 0, - type: typeMap[query.type || 'new'] || '0' //0为新晋,1为热门 + type: typeMap[query.type || 'new'] || '0', //0为新晋,1为热门 } - return request( - 'POST', `https://music.163.com/api/djradio/toplist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/djradio/toplist`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/dj_toplist_hours.js b/module/dj_toplist_hours.js index 37c6040a491..8c8b6a37874 100644 --- a/module/dj_toplist_hours.js +++ b/module/dj_toplist_hours.js @@ -2,11 +2,13 @@ module.exports = (query, request) => { const data = { - limit: query.limit || 100 + limit: query.limit || 100, // 不支持 offset } - return request( - 'POST', `https://music.163.com/api/dj/toplist/hours`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/dj/toplist/hours`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/dj_toplist_newcomer.js b/module/dj_toplist_newcomer.js index b3a3588e5b6..e6b75d47b7f 100644 --- a/module/dj_toplist_newcomer.js +++ b/module/dj_toplist_newcomer.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 100, - offset: query.offset || 0 + offset: query.offset || 0, } return request( - 'POST', `https://music.163.com/api/dj/toplist/newcomer`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/dj/toplist/newcomer`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_toplist_pay.js b/module/dj_toplist_pay.js index c82802dfbd8..6fd526c3e4e 100644 --- a/module/dj_toplist_pay.js +++ b/module/dj_toplist_pay.js @@ -1,11 +1,18 @@ // 付费精品 module.exports = (query, request) => { const data = { - limit: query.limit || 100 + limit: query.limit || 100, // 不支持 offset } return request( - 'POST', `https://music.163.com/api/djradio/toplist/pay`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/djradio/toplist/pay`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/dj_toplist_popular.js b/module/dj_toplist_popular.js index ef261d70f49..fcb0b33c1d5 100644 --- a/module/dj_toplist_popular.js +++ b/module/dj_toplist_popular.js @@ -2,11 +2,13 @@ module.exports = (query, request) => { const data = { - limit: query.limit || 100 + limit: query.limit || 100, // 不支持 offset } - return request( - 'POST', `https://music.163.com/api/dj/toplist/popular`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/dj/toplist/popular`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/event.js b/module/event.js index 48fa875a1fd..b975ab72827 100644 --- a/module/event.js +++ b/module/event.js @@ -2,11 +2,13 @@ module.exports = (query, request) => { const data = { - 'pagesize': query.pagesize || 20, - 'lasttime': query.lasttime || -1 + pagesize: query.pagesize || 20, + lasttime: query.lasttime || -1, } - return request( - 'POST', `https://music.163.com/weapi/v1/event/get`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/v1/event/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/event_del.js b/module/event_del.js index 6baa1ece583..8f17ebeb93f 100644 --- a/module/event_del.js +++ b/module/event_del.js @@ -4,8 +4,10 @@ module.exports = (query, request) => { const data = { id: query.evId, } - return request( - 'POST', `https://music.163.com/eapi/event/delete`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/eapi/event/delete`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/event_forward.js b/module/event_forward.js index daba5a45233..f4eddc4334d 100644 --- a/module/event_forward.js +++ b/module/event_forward.js @@ -1,15 +1,16 @@ // 转发动态 module.exports = (query, request) => { - query.cookie.os = 'pc'; + query.cookie.os = 'pc' const data = { forwards: query.forwards, id: query.evId, - eventUserId: query.uid - }; + eventUserId: query.uid, + } return request('POST', `https://music.163.com/weapi/event/forward`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/fm_trash.js b/module/fm_trash.js index 8b84f0e144b..224d2daad2c 100644 --- a/module/fm_trash.js +++ b/module/fm_trash.js @@ -2,10 +2,19 @@ module.exports = (query, request) => { const data = { - songId: query.id + songId: query.id, } return request( - 'POST', `https://music.163.com/weapi/radio/trash/add?alg=RT&songId=${query.id}&time=${query.time || 25}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/radio/trash/add?alg=RT&songId=${ + query.id + }&time=${query.time || 25}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/follow.js b/module/follow.js index 41718b02158..1e4f3939b2f 100644 --- a/module/follow.js +++ b/module/follow.js @@ -2,9 +2,16 @@ module.exports = (query, request) => { query.cookie.os = 'pc' - query.t = (query.t == 1 ? 'follow' : 'delfollow') + query.t = query.t == 1 ? 'follow' : 'delfollow' return request( - 'POST', `https://music.163.com/weapi/user/${query.t}/${query.id}`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/user/${query.t}/${query.id}`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/history_recommend_songs.js b/module/history_recommend_songs.js index 3f1afeba088..67c1b0bd70a 100644 --- a/module/history_recommend_songs.js +++ b/module/history_recommend_songs.js @@ -2,10 +2,16 @@ module.exports = (query, request) => { query.cookie.os = 'ios' - const data = { - } + const data = {} return request( - 'POST', `https://music.163.com/api/discovery/recommend/songs/history/recent`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/discovery/recommend/songs/history/recent`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/history_recommend_songs_detail.js b/module/history_recommend_songs_detail.js index 990ad5db4a8..b5d3645a58a 100644 --- a/module/history_recommend_songs_detail.js +++ b/module/history_recommend_songs_detail.js @@ -6,7 +6,14 @@ module.exports = (query, request) => { date: query.date || '', } return request( - 'POST', `https://music.163.com/api/discovery/recommend/songs/history/detail`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/discovery/recommend/songs/history/detail`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/homepage_block_page.js b/module/homepage_block_page.js index bb57f5b35bb..4cfd94673e0 100644 --- a/module/homepage_block_page.js +++ b/module/homepage_block_page.js @@ -1,10 +1,17 @@ // 首页-发现 block page -// 这个接口为移动端接口,首页-发现页,数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L259 HomeBlockPageWrap +// 这个接口为移动端接口,首页-发现页,数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L259 HomeBlockPageWrap // query.refresh 是否刷新数据 module.exports = (query, request) => { - const data = { 'refresh': query.refresh || true } + const data = { refresh: query.refresh || true } return request( - 'POST', `https://music.163.com/api/homepage/block/page`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + 'POST', + `https://music.163.com/api/homepage/block/page`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/homepage_dragon_ball.js b/module/homepage_dragon_ball.js index ac155395903..e76911a3029 100644 --- a/module/homepage_dragon_ball.js +++ b/module/homepage_dragon_ball.js @@ -1,16 +1,19 @@ // 首页-发现 dragon ball // 这个接口为移动端接口,首页-发现页(每日推荐、歌单、排行榜 那些入口) -// 数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L290 HomeDragonBallWrap +// 数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L290 HomeDragonBallWrap // !需要登录或者匿名登录,非登录返回 [] module.exports = (query, request) => { const data = {} return request( - 'POST', `https://music.163.com/eapi/homepage/dragon/ball/static`, data, + 'POST', + `https://music.163.com/eapi/homepage/dragon/ball/static`, + data, { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/homepage/dragon/ball/static' + url: '/api/homepage/dragon/ball/static', + realIP: query.realIP, } ) -} \ No newline at end of file +} diff --git a/module/hot_topic.js b/module/hot_topic.js index c1889ba9d9c..bba8480b6ba 100644 --- a/module/hot_topic.js +++ b/module/hot_topic.js @@ -3,10 +3,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 20, - offset: query.offset || 0 + offset: query.offset || 0, } - return request( - 'POST', `http://music.163.com/weapi/act/hot`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -}; \ No newline at end of file + return request('POST', `http://music.163.com/weapi/act/hot`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/like.js b/module/like.js index f44e58a1e8d..1aea4055431 100644 --- a/module/like.js +++ b/module/like.js @@ -5,14 +5,19 @@ module.exports = (query, request) => { query.like = query.like == 'false' ? false : true const data = { trackId: query.id, - like: query.like + like: query.like, } return request( 'POST', - `https://music.163.com/weapi/radio/like?alg=${query.alg || - 'itembased'}&trackId=${query.id}&time=${query.time || - 25}`, + `https://music.163.com/weapi/radio/like?alg=${ + query.alg || 'itembased' + }&trackId=${query.id}&time=${query.time || 25}`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/likelist.js b/module/likelist.js index 3cc0f34455f..abb46809fd1 100644 --- a/module/likelist.js +++ b/module/likelist.js @@ -2,10 +2,12 @@ module.exports = (query, request) => { const data = { - uid: query.uid + uid: query.uid, } - return request( - 'POST', `https://music.163.com/weapi/song/like/get`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/song/like/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/login.js b/module/login.js index b77c083ded5..a201b6ff372 100644 --- a/module/login.js +++ b/module/login.js @@ -6,21 +6,31 @@ module.exports = async (query, request) => { query.cookie.os = 'pc' const data = { username: query.email, - password: query.md5_password || crypto.createHash('md5').update(query.password).digest('hex'), - rememberLogin: 'true' + password: + query.md5_password || + crypto.createHash('md5').update(query.password).digest('hex'), + rememberLogin: 'true', } let result = await request( - 'POST', `https://music.163.com/weapi/login`, data, - { crypto: 'weapi', ua: 'pc', cookie: query.cookie, proxy: query.proxy } + 'POST', + `https://music.163.com/weapi/login`, + data, + { + crypto: 'weapi', + ua: 'pc', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) if (result.body.code === 502) { return { status: 200, body: { - 'msg': '账号或密码错误', - 'code': 502, - 'message': '账号或密码错误' - } + msg: '账号或密码错误', + code: 502, + message: '账号或密码错误', + }, } } if (result.body.code === 200) { @@ -28,10 +38,10 @@ module.exports = async (query, request) => { status: 200, body: { ...result.body, - cookie: result.cookie.join(';') + cookie: result.cookie.join(';'), }, - cookie: result.cookie + cookie: result.cookie, } } return result -} \ No newline at end of file +} diff --git a/module/login_cellphone.js b/module/login_cellphone.js index 51bca302c74..f33f2c1f946 100644 --- a/module/login_cellphone.js +++ b/module/login_cellphone.js @@ -7,22 +7,32 @@ module.exports = async (query, request) => { const data = { phone: query.phone, countrycode: query.countrycode, - password: query.md5_password || crypto.createHash('md5').update(query.password).digest('hex'), - rememberLogin: 'true' + password: + query.md5_password || + crypto.createHash('md5').update(query.password).digest('hex'), + rememberLogin: 'true', } let result = await request( - 'POST', `https://music.163.com/weapi/login/cellphone`, data, - {crypto: 'weapi', ua: 'pc', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/login/cellphone`, + data, + { + crypto: 'weapi', + ua: 'pc', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) - + if (result.body.code === 200) { result = { status: 200, body: { ...result.body, - cookie: result.cookie.join(';') + cookie: result.cookie.join(';'), }, - cookie: result.cookie + cookie: result.cookie, } } return result diff --git a/module/login_refresh.js b/module/login_refresh.js index a6f43f2cbfa..2a6e88ad71f 100644 --- a/module/login_refresh.js +++ b/module/login_refresh.js @@ -2,7 +2,15 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/login/token/refresh`, {}, - {crypto: 'weapi', ua: 'pc', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/login/token/refresh`, + {}, + { + crypto: 'weapi', + ua: 'pc', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/login_status.js b/module/login_status.js index 91f417fb4fd..b653a0f9c27 100644 --- a/module/login_status.js +++ b/module/login_status.js @@ -2,20 +2,20 @@ module.exports = (query, request) => { return request( - 'GET', `https://music.163.com`, {}, - {cookie: query.cookie, proxy: query.proxy} - ) - .then(response => { - try{ - let profile = eval(`(${/GUser\s*=\s*([^;]+);/.exec(response.body)[1]})`) - let bindings = eval(`(${/GBinds\s*=\s*([^;]+);/.exec(response.body)[1]})`) - response.body = {code: 200, profile: profile, bindings: bindings} - return response - } - catch(err){ - response.status = 301 - response.body = {code: 301} - return Promise.reject(response) - } - }) -} \ No newline at end of file + 'GET', + `https://music.163.com`, + {}, + { cookie: query.cookie, proxy: query.proxy, realIP: query.realIP } + ).then((response) => { + try { + let profile = eval(`(${/GUser\s*=\s*([^;]+);/.exec(response.body)[1]})`) + let bindings = eval(`(${/GBinds\s*=\s*([^;]+);/.exec(response.body)[1]})`) + response.body = { code: 200, profile: profile, bindings: bindings } + return response + } catch (err) { + response.status = 301 + response.body = { code: 301 } + return Promise.reject(response) + } + }) +} diff --git a/module/logout.js b/module/logout.js index d5f3b7db635..4bae68821b2 100644 --- a/module/logout.js +++ b/module/logout.js @@ -2,7 +2,15 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/logout`, {}, - {crypto: 'weapi', ua: 'pc', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/logout`, + {}, + { + crypto: 'weapi', + ua: 'pc', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/lyric.js b/module/lyric.js index 760dc417dd4..1c1a7fbb87b 100644 --- a/module/lyric.js +++ b/module/lyric.js @@ -1,17 +1,17 @@ // 歌词 module.exports = (query, request) => { - query.cookie.os = 'pc'; + query.cookie.os = 'pc' const data = { id: query.id, lv: -1, kv: -1, - tv: -1 + tv: -1, } - return request( - 'POST', - `https://music.163.com/api/song/lyric`, - data, - { crypto: 'linuxapi', cookie: query.cookie, proxy: query.proxy } - ) + return request('POST', `https://music.163.com/api/song/lyric`, data, { + crypto: 'linuxapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) } diff --git a/module/msg_comments.js b/module/msg_comments.js index 36e1e38959b..f1bef5bd412 100644 --- a/module/msg_comments.js +++ b/module/msg_comments.js @@ -5,9 +5,9 @@ module.exports = (query, request) => { beforeTime: query.before || '-1', limit: query.limit || 30, total: 'true', - uid: query.uid - }; - + uid: query.uid, + } + return request( 'POST', `https://music.163.com/api/v1/user/comments/${query.uid}`, @@ -15,7 +15,8 @@ module.exports = (query, request) => { { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy + proxy: query.proxy, + realIP: query.realIP, } - ); -}; + ) +} diff --git a/module/msg_forwards.js b/module/msg_forwards.js index 8663bf4b31f..f89dc989d72 100644 --- a/module/msg_forwards.js +++ b/module/msg_forwards.js @@ -4,11 +4,12 @@ module.exports = (query, request) => { const data = { offset: query.offset || 0, limit: query.limit || 30, - total: 'true' - }; + total: 'true', + } return request('POST', `https://music.163.com/api/forwards/get`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/msg_notices.js b/module/msg_notices.js index 0578ba87fd1..9208168bb62 100644 --- a/module/msg_notices.js +++ b/module/msg_notices.js @@ -3,11 +3,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, - time: query.lasttime || -1 - }; + time: query.lasttime || -1, + } return request('POST', `https://music.163.com/api/msg/notices`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/msg_private.js b/module/msg_private.js index 91f9ea5d953..a30751c682f 100644 --- a/module/msg_private.js +++ b/module/msg_private.js @@ -5,10 +5,11 @@ module.exports = (query, request) => { offset: query.offset || 0, limit: query.limit || 30, total: 'true', - }; + } return request('POST', `https://music.163.com/api/msg/private/users`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/msg_private_history.js b/module/msg_private_history.js index 27ad29180f9..bfbedde5e2d 100644 --- a/module/msg_private_history.js +++ b/module/msg_private_history.js @@ -5,8 +5,8 @@ module.exports = (query, request) => { userId: query.uid, limit: query.limit || 30, time: query.before || 0, - total: 'true' - }; + total: 'true', + } return request( 'POST', `https://music.163.com/api/msg/private/history`, @@ -14,7 +14,8 @@ module.exports = (query, request) => { { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy + proxy: query.proxy, + realIP: query.realIP, } - ); -}; + ) +} diff --git a/module/mv_all.js b/module/mv_all.js index 42777dfde4c..85c1c464978 100644 --- a/module/mv_all.js +++ b/module/mv_all.js @@ -5,15 +5,16 @@ module.exports = (query, request) => { tags: JSON.stringify({ 地区: query.area || '全部', 类型: query.type || '全部', - 排序: query.order || '上升最快' + 排序: query.order || '上升最快', }), offset: query.offset || 0, total: 'true', - limit: query.limit || 30 - }; + limit: query.limit || 30, + } return request('POST', `https://interface.music.163.com/api/mv/all`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/mv_detail.js b/module/mv_detail.js index 1cda103d92e..e1b0152ee0c 100644 --- a/module/mv_detail.js +++ b/module/mv_detail.js @@ -2,10 +2,12 @@ module.exports = (query, request) => { const data = { - id: query.mvid + id: query.mvid, } - return request( - 'POST', `https://music.163.com/api/v1/mv/detail`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/api/v1/mv/detail`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/mv_detail_info.js b/module/mv_detail_info.js index c7aad0b660c..61c4707c3f5 100644 --- a/module/mv_detail_info.js +++ b/module/mv_detail_info.js @@ -2,11 +2,18 @@ module.exports = (query, request) => { const data = { - 'threadid': `R_MV_5_${query.mvid}`, - 'composeliked': true + threadid: `R_MV_5_${query.mvid}`, + composeliked: true, } return request( - 'POST', `https://music.163.com/api/comment/commentthread/info`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + 'POST', + `https://music.163.com/api/comment/commentthread/info`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/mv_exclusive_rcmd.js b/module/mv_exclusive_rcmd.js index 8aaf715ce91..8ea3043e55d 100644 --- a/module/mv_exclusive_rcmd.js +++ b/module/mv_exclusive_rcmd.js @@ -3,8 +3,8 @@ module.exports = (query, request) => { const data = { offset: query.offset || 0, - limit: query.limit || 30 - }; + limit: query.limit || 30, + } return request( 'POST', `https://interface.music.163.com/api/mv/exclusive/rcmd`, @@ -12,7 +12,8 @@ module.exports = (query, request) => { { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy + proxy: query.proxy, + realIP: query.realIP, } - ); -}; + ) +} diff --git a/module/mv_first.js b/module/mv_first.js index e83e372009a..d22f60ebf58 100644 --- a/module/mv_first.js +++ b/module/mv_first.js @@ -5,11 +5,17 @@ module.exports = (query, request) => { // 'offset': query.offset || 0, area: query.area || '', limit: query.limit || 30, - total: true - }; - return request('POST', `https://interface.music.163.com/weapi/mv/first`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy - }); -}; + total: true, + } + return request( + 'POST', + `https://interface.music.163.com/weapi/mv/first`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/mv_sub.js b/module/mv_sub.js index 9f2c225c4f8..249998e9407 100644 --- a/module/mv_sub.js +++ b/module/mv_sub.js @@ -1,13 +1,15 @@ // 收藏与取消收藏MV module.exports = (query, request) => { - query.t = (query.t == 1 ? 'sub' : 'unsub') + query.t = query.t == 1 ? 'sub' : 'unsub' const data = { mvId: query.mvid, - mvIds: '["' + query.mvid + '"]' - } - return request( - 'POST', `https://music.163.com/weapi/mv/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + mvIds: '["' + query.mvid + '"]', + } + return request('POST', `https://music.163.com/weapi/mv/${query.t}`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/mv_sublist.js b/module/mv_sublist.js index 1330849ffa7..d86633b7c3d 100644 --- a/module/mv_sublist.js +++ b/module/mv_sublist.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 25, offset: query.offset || 0, - total: true + total: true, } return request( - 'POST', `https://music.163.com/weapi/cloudvideo/allvideo/sublist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/cloudvideo/allvideo/sublist`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/mv_url.js b/module/mv_url.js index d4bb7d2cd2a..b8e778394b1 100644 --- a/module/mv_url.js +++ b/module/mv_url.js @@ -3,10 +3,17 @@ module.exports = (query, request) => { const data = { id: query.id, - r: query.res || 1080 + r: query.res || 1080, } return request( - 'POST', `https://music.163.com/weapi/song/enhance/play/mv/url`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/song/enhance/play/mv/url`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/personal_fm.js b/module/personal_fm.js index 7c0d70f54f0..e2f7a589f81 100644 --- a/module/personal_fm.js +++ b/module/personal_fm.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/v1/radio/get`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/radio/get`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/personalized.js b/module/personalized.js index 73748e5571a..45f22bc0242 100644 --- a/module/personalized.js +++ b/module/personalized.js @@ -5,10 +5,17 @@ module.exports = (query, request) => { limit: query.limit || 30, // offset: query.offset || 0, total: true, - n: 1000 + n: 1000, } return request( - 'POST', `https://music.163.com/weapi/personalized/playlist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/personalized/playlist`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/personalized_djprogram.js b/module/personalized_djprogram.js index 4e43afc89be..9b945b4ba94 100644 --- a/module/personalized_djprogram.js +++ b/module/personalized_djprogram.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/personalized/djprogram`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/personalized/djprogram`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/personalized_mv.js b/module/personalized_mv.js index 325a764ae42..0af706f1a72 100644 --- a/module/personalized_mv.js +++ b/module/personalized_mv.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/personalized/mv`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/personalized/mv`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/personalized_newsong.js b/module/personalized_newsong.js index 7ce289be823..efce8148b79 100644 --- a/module/personalized_newsong.js +++ b/module/personalized_newsong.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { - type: 'recommend' + type: 'recommend', } return request( - 'POST', `https://music.163.com/weapi/personalized/newsong`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/personalized/newsong`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/personalized_privatecontent.js b/module/personalized_privatecontent.js index 2c9b3ae7530..b516d1ab041 100644 --- a/module/personalized_privatecontent.js +++ b/module/personalized_privatecontent.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/personalized/privatecontent`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/personalized/privatecontent`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/personalized_privatecontent_list.js b/module/personalized_privatecontent_list.js index 8b47188f077..35fa1868f53 100644 --- a/module/personalized_privatecontent_list.js +++ b/module/personalized_privatecontent_list.js @@ -8,7 +8,13 @@ module.exports = (query, request) => { } return request( 'POST', - `https://music.163.com/api/v2/privatecontent/list`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + `https://music.163.com/api/v2/privatecontent/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/playlist_catlist.js b/module/playlist_catlist.js index e354d4af714..814882eab82 100644 --- a/module/playlist_catlist.js +++ b/module/playlist_catlist.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/playlist/catalogue`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/playlist/catalogue`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/playlist_cover_update.js b/module/playlist_cover_update.js index 96b68ebaea5..ef529ecd258 100644 --- a/module/playlist_cover_update.js +++ b/module/playlist_cover_update.js @@ -6,9 +6,14 @@ module.exports = async (query, request) => { `https://music.163.com/weapi/playlist/cover/update`, { id: query.id, - coverImgId: uploadInfo.imgId + coverImgId: uploadInfo.imgId, }, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) return { status: 200, diff --git a/module/playlist_create.js b/module/playlist_create.js index a8abe547186..7790ae13c95 100644 --- a/module/playlist_create.js +++ b/module/playlist_create.js @@ -1,14 +1,15 @@ // 创建歌单 module.exports = (query, request) => { - query.cookie.os = 'pc'; + query.cookie.os = 'pc' const data = { name: query.name, - privacy: query.privacy //0 为普通歌单,10 为隐私歌单 - }; + privacy: query.privacy, //0 为普通歌单,10 为隐私歌单 + } return request('POST', `https://music.163.com/weapi/playlist/create`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/playlist_delete.js b/module/playlist_delete.js index d2032727db1..d388a0ebfeb 100644 --- a/module/playlist_delete.js +++ b/module/playlist_delete.js @@ -1,13 +1,14 @@ // 删除歌单 module.exports = (query, request) => { - query.cookie.os = 'pc'; + query.cookie.os = 'pc' const data = { - ids: '[' + query.id + ']' - }; + ids: '[' + query.id + ']', + } return request('POST', `https://music.163.com/weapi/playlist/remove`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/playlist_desc_update.js b/module/playlist_desc_update.js index 316df107b84..790229afced 100644 --- a/module/playlist_desc_update.js +++ b/module/playlist_desc_update.js @@ -3,15 +3,18 @@ module.exports = (query, request) => { const data = { id: query.id, - desc: query.desc + desc: query.desc, } return request( - 'POST', `http://interface3.music.163.com/eapi/playlist/desc/update`, data, + 'POST', + `http://interface3.music.163.com/eapi/playlist/desc/update`, + data, { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/playlist/desc/update' + url: '/api/playlist/desc/update', + realIP: query.realIP, } ) -} \ No newline at end of file +} diff --git a/module/playlist_detail.js b/module/playlist_detail.js index 22f36e0258c..4f65b380da9 100644 --- a/module/playlist_detail.js +++ b/module/playlist_detail.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { id: query.id, n: 100000, - s: query.s || 8 + s: query.s || 8, } return request( - 'POST', `https://music.163.com/weapi/v3/playlist/detail`, data, - {crypto: 'linuxapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v3/playlist/detail`, + data, + { + crypto: 'linuxapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/playlist_hot.js b/module/playlist_hot.js index 8e8c25688f5..57cc40e6424 100644 --- a/module/playlist_hot.js +++ b/module/playlist_hot.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/playlist/hottags`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/playlist/hottags`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/playlist_name_update.js b/module/playlist_name_update.js index 12cb602a238..5ce73f19514 100644 --- a/module/playlist_name_update.js +++ b/module/playlist_name_update.js @@ -3,15 +3,18 @@ module.exports = (query, request) => { const data = { id: query.id, - name: query.name + name: query.name, } return request( - 'POST', `http://interface3.music.163.com/eapi/playlist/update/name`, data, + 'POST', + `http://interface3.music.163.com/eapi/playlist/update/name`, + data, { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/playlist/update/name' + url: '/api/playlist/update/name', + realIP: query.realIP, } ) -} \ No newline at end of file +} diff --git a/module/playlist_order_update.js b/module/playlist_order_update.js index 44e5f6d4839..11c512bead7 100644 --- a/module/playlist_order_update.js +++ b/module/playlist_order_update.js @@ -3,10 +3,17 @@ module.exports = (query, request) => { query.cookie.os = 'pc' const data = { - ids: query.ids + ids: query.ids, } return request( - 'POST', `https://music.163.com/api/playlist/order/update`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/playlist/order/update`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/playlist_subscribe.js b/module/playlist_subscribe.js index 9f94b9dba8b..cf9c2aef4c3 100644 --- a/module/playlist_subscribe.js +++ b/module/playlist_subscribe.js @@ -1,12 +1,19 @@ // 收藏与取消收藏歌单 module.exports = (query, request) => { - query.t = (query.t == 1 ? 'subscribe' : 'unsubscribe') + query.t = query.t == 1 ? 'subscribe' : 'unsubscribe' const data = { - id: query.id + id: query.id, } return request( - 'POST', `https://music.163.com/weapi/playlist/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/playlist/${query.t}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/playlist_subscribers.js b/module/playlist_subscribers.js index 8db788b7b2f..9094f46503c 100644 --- a/module/playlist_subscribers.js +++ b/module/playlist_subscribers.js @@ -4,12 +4,17 @@ module.exports = (query, request) => { const data = { id: query.id, limit: query.limit || 20, - offset: query.offset || 0 - }; + offset: query.offset || 0, + } return request( 'POST', `https://music.163.com/weapi/playlist/subscribers`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/playlist_tags_update.js b/module/playlist_tags_update.js index 9d812830d05..4b026ed52de 100644 --- a/module/playlist_tags_update.js +++ b/module/playlist_tags_update.js @@ -3,15 +3,18 @@ module.exports = (query, request) => { const data = { id: query.id, - tags: query.tags + tags: query.tags, } return request( - 'POST', `http://interface3.music.163.com/eapi/playlist/tags/update`, data, + 'POST', + `http://interface3.music.163.com/eapi/playlist/tags/update`, + data, { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/playlist/tags/update' + url: '/api/playlist/tags/update', + realIP: query.realIP, } ) -} \ No newline at end of file +} diff --git a/module/playlist_tracks.js b/module/playlist_tracks.js index b2afe1b382f..17ccb86dd07 100644 --- a/module/playlist_tracks.js +++ b/module/playlist_tracks.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { op: query.op, // del,add pid: query.pid, // 歌单id - trackIds: '[' + query.tracks + ']' // 歌曲id + trackIds: '[' + query.tracks + ']', // 歌曲id } return request( - 'POST', `https://music.163.com/weapi/playlist/manipulate/tracks`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/playlist/manipulate/tracks`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/playlist_update.js b/module/playlist_update.js index 204dd141722..085d195ed70 100644 --- a/module/playlist_update.js +++ b/module/playlist_update.js @@ -7,10 +7,12 @@ module.exports = (query, request) => { const data = { '/api/playlist/desc/update': `{"id":${query.id},"desc":"${query.desc}"}`, '/api/playlist/tags/update': `{"id":${query.id},"tags":"${query.tags}"}`, - '/api/playlist/update/name': `{"id":${query.id},"name":"${query.name}"}` + '/api/playlist/update/name': `{"id":${query.id},"name":"${query.name}"}`, } - return request( - 'POST', `https://music.163.com/weapi/batch`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/batch`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/playmode_intelligence_list.js b/module/playmode_intelligence_list.js index e91ee7546c2..f8cc7a4d05a 100644 --- a/module/playmode_intelligence_list.js +++ b/module/playmode_intelligence_list.js @@ -6,12 +6,17 @@ module.exports = (query, request) => { type: 'fromPlayOne', playlistId: query.pid, startMusicId: query.sid || query.id, - count: query.count || 1 - }; + count: query.count || 1, + } return request( 'POST', `http://music.163.com/weapi/playmode/intelligence/list`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/program_recommend.js b/module/program_recommend.js index 3d9295468c2..9302b911798 100644 --- a/module/program_recommend.js +++ b/module/program_recommend.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { cateId: query.type, limit: query.limit || 10, - offset: query.offset || 0 + offset: query.offset || 0, } return request( - 'POST', `https://music.163.com/weapi/program/recommend/v1`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/program/recommend/v1`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/rebind.js b/module/rebind.js index 7de771312ff..c79d7e13c6e 100644 --- a/module/rebind.js +++ b/module/rebind.js @@ -5,12 +5,17 @@ module.exports = (query, request) => { captcha: query.captcha, phone: query.phone, oldcaptcha: query.oldcaptcha, - ctcode: query.ctcode || '86' - }; + ctcode: query.ctcode || '86', + } return request( 'POST', `https://music.163.com/api/user/replaceCellphone`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/recommend_resource.js b/module/recommend_resource.js index ce53c526e43..104775d2eb3 100644 --- a/module/recommend_resource.js +++ b/module/recommend_resource.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/v1/discovery/recommend/resource`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/discovery/recommend/resource`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/recommend_songs.js b/module/recommend_songs.js index efb270d04f3..b88d4576d4c 100644 --- a/module/recommend_songs.js +++ b/module/recommend_songs.js @@ -2,10 +2,16 @@ module.exports = (query, request) => { query.cookie.os = 'ios' - const data = { - } + const data = {} return request( - 'POST', `https://music.163.com/api/v3/discovery/recommend/songs`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/v3/discovery/recommend/songs`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/register_cellphone.js b/module/register_cellphone.js index fcb1a982261..e46af3e3f23 100644 --- a/module/register_cellphone.js +++ b/module/register_cellphone.js @@ -7,12 +7,17 @@ module.exports = (query, request) => { captcha: query.captcha, phone: query.phone, password: crypto.createHash('md5').update(query.password).digest('hex'), - nickname: query.nickname + nickname: query.nickname, } return request( 'POST', `https://music.163.com/weapi/register/cellphone`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/related_allvideo.js b/module/related_allvideo.js index 21d9823012b..3de13a91c68 100644 --- a/module/related_allvideo.js +++ b/module/related_allvideo.js @@ -3,10 +3,17 @@ module.exports = (query, request) => { const data = { id: query.id, - type: (/^\d+$/.test(query.id)) ? 0 : 1 + type: /^\d+$/.test(query.id) ? 0 : 1, } return request( - 'POST', `https://music.163.com/weapi/cloudvideo/v1/allvideo/rcmd`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/cloudvideo/v1/allvideo/rcmd`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/related_playlist.js b/module/related_playlist.js index 3e4a540cd11..38ed9cb1c82 100644 --- a/module/related_playlist.js +++ b/module/related_playlist.js @@ -2,31 +2,32 @@ module.exports = (query, request) => { return request( - 'GET', `https://music.163.com/playlist?id=${query.id}`, {}, - {ua: 'pc', cookie: query.cookie, proxy: query.proxy} - ) - .then(response => { - try{ - const pattern = /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g; - let result, playlists = [] - while((result = pattern.exec(response.body)) != null){ - playlists.push({ - creator: { - userId: result[4].slice('/user/home?id='.length), - nickname: result[5] - }, - coverImgUrl: result[1].slice(0, -('?param=50y50'.length)), - name: result[3], - id: result[2].slice('/playlist?id='.length) - }) - } - response.body = {code: 200, playlists: playlists} - return response + 'GET', + `https://music.163.com/playlist?id=${query.id}`, + {}, + { ua: 'pc', cookie: query.cookie, proxy: query.proxy, realIP: query.realIP } + ).then((response) => { + try { + const pattern = /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g + let result, + playlists = [] + while ((result = pattern.exec(response.body)) != null) { + playlists.push({ + creator: { + userId: result[4].slice('/user/home?id='.length), + nickname: result[5], + }, + coverImgUrl: result[1].slice(0, -'?param=50y50'.length), + name: result[3], + id: result[2].slice('/playlist?id='.length), + }) } - catch(err){ - response.status = 500 - response.body = {code: 500, msg: err.stack} - return Promise.reject(response) - } - }) + response.body = { code: 200, playlists: playlists } + return response + } catch (err) { + response.status = 500 + response.body = { code: 500, msg: err.stack } + return Promise.reject(response) + } + }) } diff --git a/module/resource_like.js b/module/resource_like.js index ae192c07330..d907136de6d 100644 --- a/module/resource_like.js +++ b/module/resource_like.js @@ -2,21 +2,28 @@ module.exports = (query, request) => { query.cookie.os = 'pc' - query.t = (query.t == 1 ? 'like' : 'unlike') + query.t = query.t == 1 ? 'like' : 'unlike' query.type = { 1: 'R_MV_5_', // MV 4: 'A_DJ_1_', // 电台 5: 'R_VI_62_', // 视频 - 6: 'A_EV_2_' + 6: 'A_EV_2_', }[query.type] const data = { - threadId: query.type + query.id + threadId: query.type + query.id, } - if(query.type=='A_EV_2_'){ - data.threadId=query.threadId + if (query.type === 'A_EV_2_') { + data.threadId = query.threadId } return request( - 'POST', `https://music.163.com/weapi/resource/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/resource/${query.t}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/scrobble.js b/module/scrobble.js index 922e931746e..ad542d5f281 100644 --- a/module/scrobble.js +++ b/module/scrobble.js @@ -2,22 +2,26 @@ module.exports = (query, request) => { const data = { - logs: JSON.stringify([{ - action: 'play', - json: { - download: 0, - end: 'playend', - id: query.id, - sourceId: query.sourceid, - time: query.time, - type: 'song', - wifi: 0, - } - }]) + logs: JSON.stringify([ + { + action: 'play', + json: { + download: 0, + end: 'playend', + id: query.id, + sourceId: query.sourceid, + time: query.time, + type: 'song', + wifi: 0, + }, + }, + ]), } - - return request( - 'POST', `https://music.163.com/weapi/feedback/weblog`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) + + return request('POST', `https://music.163.com/weapi/feedback/weblog`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) } diff --git a/module/search.js b/module/search.js index 07b97ad1df8..b2e1ff99058 100644 --- a/module/search.js +++ b/module/search.js @@ -5,10 +5,12 @@ module.exports = (query, request) => { s: query.keywords, type: query.type || 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频 limit: query.limit || 30, - offset: query.offset || 0 + offset: query.offset || 0, } - return request( - 'POST', `https://music.163.com/weapi/search/get`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/search/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/search_default.js b/module/search_default.js index 206f9cf8aa9..0d40840c979 100644 --- a/module/search_default.js +++ b/module/search_default.js @@ -2,13 +2,15 @@ module.exports = (query, request) => { return request( - 'POST', `http://interface3.music.163.com/eapi/search/defaultkeyword/get`, {}, + 'POST', + `http://interface3.music.163.com/eapi/search/defaultkeyword/get`, + {}, { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/search/defaultkeyword/get' + url: '/api/search/defaultkeyword/get', + realIP: query.realIP, } ) } - diff --git a/module/search_hot.js b/module/search_hot.js index 2a980e560ea..75c95a6f4b2 100644 --- a/module/search_hot.js +++ b/module/search_hot.js @@ -2,10 +2,13 @@ module.exports = (query, request) => { const data = { - type: 1111 + type: 1111, } - return request( - 'POST', `https://music.163.com/weapi/search/hot`, data, - {crypto: 'weapi', ua: 'mobile', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/search/hot`, data, { + crypto: 'weapi', + ua: 'mobile', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/search_hot_detail.js b/module/search_hot_detail.js index eb4b01af922..902ba0b27bd 100644 --- a/module/search_hot_detail.js +++ b/module/search_hot_detail.js @@ -1,11 +1,15 @@ // 热搜列表 module.exports = (query, request) => { - const data = { - }; + const data = {} return request( 'POST', `https://music.163.com/weapi/hotsearchlist/get`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/search_multimatch.js b/module/search_multimatch.js index 623c22e4e96..13dbfa3b202 100644 --- a/module/search_multimatch.js +++ b/module/search_multimatch.js @@ -3,10 +3,17 @@ module.exports = (query, request) => { const data = { type: query.type || 1, - s: query.keywords || '' + s: query.keywords || '', } return request( - 'POST', `https://music.163.com/weapi/search/suggest/multimatch`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/search/suggest/multimatch`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/search_suggest.js b/module/search_suggest.js index 2bdb9a456ce..68098b3299d 100644 --- a/module/search_suggest.js +++ b/module/search_suggest.js @@ -2,11 +2,18 @@ module.exports = (query, request) => { const data = { - s: query.keywords || '' + s: query.keywords || '', } let type = query.type == 'mobile' ? 'keyword' : 'web' return request( - 'POST', `https://music.163.com/weapi/search/suggest/` + type, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + 'POST', + `https://music.163.com/weapi/search/suggest/` + type, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/send_playlist.js b/module/send_playlist.js index f5d7f3540e2..a1d9bd46d24 100644 --- a/module/send_playlist.js +++ b/module/send_playlist.js @@ -6,10 +6,12 @@ module.exports = (query, request) => { id: query.playlist, type: 'playlist', msg: query.msg, - userIds: '[' + query.user_ids + ']' + userIds: '[' + query.user_ids + ']', } - return request( - 'POST', `https://music.163.com/weapi/msg/private/send`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/msg/private/send`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/send_text.js b/module/send_text.js index bfa45dc03d4..22e7540c8a2 100644 --- a/module/send_text.js +++ b/module/send_text.js @@ -6,10 +6,12 @@ module.exports = (query, request) => { id: query.playlist, type: 'text', msg: query.msg, - userIds: '[' + query.user_ids + ']' + userIds: '[' + query.user_ids + ']', } - return request( - 'POST', `https://music.163.com/weapi/msg/private/send`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/msg/private/send`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/setting.js b/module/setting.js index 2829c9981d4..7dd82791967 100644 --- a/module/setting.js +++ b/module/setting.js @@ -1,11 +1,11 @@ // 设置 module.exports = (query, request) => { - const data = { - - } - return request( - 'POST', `https://music.163.com/api/user/setting`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + const data = {} + return request('POST', `https://music.163.com/api/user/setting`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/share_resource.js b/module/share_resource.js index ec550cd95bd..a2aa81441bb 100644 --- a/module/share_resource.js +++ b/module/share_resource.js @@ -4,12 +4,17 @@ module.exports = (query, request) => { const data = { type: query.type || 'song', // song,playlist,mv,djprogram,djradio msg: query.msg || '', - id: query.id || '' - }; + id: query.id || '', + } return request( 'POST', `http://music.163.com/weapi/share/friends/resource`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/simi_artist.js b/module/simi_artist.js index 0c7e197a1bb..8d1ccac66cf 100644 --- a/module/simi_artist.js +++ b/module/simi_artist.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { - artistid: query.id + artistid: query.id, } return request( - 'POST', `https://music.163.com/weapi/discovery/simiArtist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/discovery/simiArtist`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/simi_mv.js b/module/simi_mv.js index c06c662f2a9..6dd1c5f1770 100644 --- a/module/simi_mv.js +++ b/module/simi_mv.js @@ -2,10 +2,12 @@ module.exports = (query, request) => { const data = { - mvid: query.mvid + mvid: query.mvid, } - return request( - 'POST', `https://music.163.com/weapi/discovery/simiMV`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/discovery/simiMV`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/simi_playlist.js b/module/simi_playlist.js index 22c0ef51ba6..2f4f622b27d 100644 --- a/module/simi_playlist.js +++ b/module/simi_playlist.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { songid: query.id, limit: query.limit || 50, - offset: query.offset || 0 + offset: query.offset || 0, } return request( - 'POST', `https://music.163.com/weapi/discovery/simiPlaylist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/discovery/simiPlaylist`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/simi_song.js b/module/simi_song.js index f70615cbd6c..cbc6d772acd 100644 --- a/module/simi_song.js +++ b/module/simi_song.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { songid: query.id, limit: query.limit || 50, - offset: query.offset || 0 + offset: query.offset || 0, } return request( - 'POST', `https://music.163.com/weapi/v1/discovery/simiSong`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/discovery/simiSong`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/simi_user.js b/module/simi_user.js index 2058d1ae91a..82c5d65a0b0 100644 --- a/module/simi_user.js +++ b/module/simi_user.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { songid: query.id, limit: query.limit || 50, - offset: query.offset || 0 + offset: query.offset || 0, } return request( - 'POST', `https://music.163.com/weapi/discovery/simiUser`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/discovery/simiUser`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/song_detail.js b/module/song_detail.js index a333af599fd..0a7d5068f38 100644 --- a/module/song_detail.js +++ b/module/song_detail.js @@ -3,11 +3,13 @@ module.exports = (query, request) => { query.ids = query.ids.split(/\s*,\s*/) const data = { - c: '[' + query.ids.map(id => ('{"id":' + id + '}')).join(',') + ']', - ids: '[' + query.ids.join(',') + ']' + c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']', + ids: '[' + query.ids.join(',') + ']', } - return request( - 'POST', `https://music.163.com/weapi/v3/song/detail`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/v3/song/detail`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/song_order_update.js b/module/song_order_update.js index 149dca8dd6b..33369b69692 100644 --- a/module/song_order_update.js +++ b/module/song_order_update.js @@ -8,12 +8,15 @@ module.exports = (query, request) => { } return request( - 'POST', `http://interface.music.163.com/api/playlist/manipulate/tracks`, data, + 'POST', + `http://interface.music.163.com/api/playlist/manipulate/tracks`, + data, { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/playlist/desc/update' + url: '/api/playlist/desc/update', + realIP: query.realIP, } ) -} \ No newline at end of file +} diff --git a/module/song_url.js b/module/song_url.js index 97ebcf80a0e..f8125ff944b 100644 --- a/module/song_url.js +++ b/module/song_url.js @@ -3,14 +3,22 @@ const crypto = require('crypto') module.exports = (query, request) => { - if(!('MUSIC_U' in query.cookie)) query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex') + if (!('MUSIC_U' in query.cookie)) + query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex') query.cookie.os = 'pc' const data = { ids: '[' + query.id + ']', - br: parseInt(query.br || 999000) + br: parseInt(query.br || 999000), } return request( - 'POST', `https://music.163.com/api/song/enhance/player/url`, data, - {crypto: 'linuxapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/song/enhance/player/url`, + data, + { + crypto: 'linuxapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/top_album.js b/module/top_album.js index a6e0f86b05a..f467bb81408 100644 --- a/module/top_album.js +++ b/module/top_album.js @@ -12,7 +12,14 @@ module.exports = (query, request) => { month: query.month || date.getMonth() + 1, } return request( - 'POST', `https://music.163.com/api/discovery/new/albums/area`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/discovery/new/albums/area`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/top_artists.js b/module/top_artists.js index 8d1223eee43..a1a40b60cc0 100644 --- a/module/top_artists.js +++ b/module/top_artists.js @@ -4,10 +4,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 50, offset: query.offset || 0, - total: true + total: true, } - return request( - 'POST', `https://music.163.com/weapi/artist/top`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/artist/top`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/top_list.js b/module/top_list.js index 7cacb4c5b35..324d318739a 100644 --- a/module/top_list.js +++ b/module/top_list.js @@ -1,23 +1,30 @@ // 排行榜 module.exports = (query, request) => { query.cookie.os = 'pc' - if(query.idx){ - return Promise.resolve( { + if (query.idx) { + return Promise.resolve({ status: 500, body: { code: 500, - msg: '不支持此方式调用,只支持id调用' - } + msg: '不支持此方式调用,只支持id调用', + }, }) } - + const data = { id: query.id, n: '500', s: '0', } return request( - 'POST', `https://interface3.music.163.com/api/playlist/v4/detail`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://interface3.music.163.com/api/playlist/v4/detail`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/top_mv.js b/module/top_mv.js index c94901bc800..2dc7c22e854 100644 --- a/module/top_mv.js +++ b/module/top_mv.js @@ -5,11 +5,12 @@ module.exports = (query, request) => { area: query.area || '', limit: query.limit || 30, offset: query.offset || 0, - total: true - }; + total: true, + } return request('POST', `https://music.163.com/weapi/mv/toplist`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/top_playlist.js b/module/top_playlist.js index cac0a6dda4c..4f41edb9689 100644 --- a/module/top_playlist.js +++ b/module/top_playlist.js @@ -6,10 +6,12 @@ module.exports = (query, request) => { order: query.order || 'hot', // hot,new limit: query.limit || 50, offset: query.offset || 0, - total: true + total: true, } - return request( - 'POST', `https://music.163.com/weapi/playlist/list`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/playlist/list`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/top_playlist_highquality.js b/module/top_playlist_highquality.js index e9fc0d736f4..669a0ce3462 100644 --- a/module/top_playlist_highquality.js +++ b/module/top_playlist_highquality.js @@ -5,10 +5,17 @@ module.exports = (query, request) => { cat: query.cat || '全部', // 全部,华语,欧美,韩语,日语,粤语,小语种,运动,ACG,影视原声,流行,摇滚,后摇,古风,民谣,轻音乐,电子,器乐,说唱,古典,爵士 limit: query.limit || 50, lasttime: query.before || 0, // 歌单updateTime - total: true + total: true, } return request( - 'POST', `https://music.163.com/weapi/playlist/highquality/list`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/playlist/highquality/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/top_song.js b/module/top_song.js index f2524df3441..f9d4d794a67 100644 --- a/module/top_song.js +++ b/module/top_song.js @@ -5,12 +5,17 @@ module.exports = (query, request) => { areaId: query.type || 0, // 全部:0 华语:7 欧美:96 日本:8 韩国:16 // limit: query.limit || 100, // offset: query.offset || 0, - total: true + total: true, } return request( 'POST', `https://music.163.com/weapi/v1/discovery/new/songs`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) } diff --git a/module/toplist.js b/module/toplist.js index 627ae3c2704..e57bd41e089 100644 --- a/module/toplist.js +++ b/module/toplist.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/api/toplist`, {}, - {crypto: 'linuxapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/api/toplist`, + {}, + { + crypto: 'linuxapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/toplist_artist.js b/module/toplist_artist.js index 6e817d83b73..825a64926d0 100644 --- a/module/toplist_artist.js +++ b/module/toplist_artist.js @@ -5,10 +5,12 @@ module.exports = (query, request) => { type: query.type || 1, limit: 100, offset: 0, - total: true + total: true, } - return request( - 'POST', `https://music.163.com/weapi/toplist/artist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/toplist/artist`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/toplist_detail.js b/module/toplist_detail.js index ff7e7c5aa0b..eca0e9d322f 100644 --- a/module/toplist_detail.js +++ b/module/toplist_detail.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/toplist/detail`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/toplist/detail`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/user_audio.js b/module/user_audio.js index d258df784f7..2e2a07097d5 100644 --- a/module/user_audio.js +++ b/module/user_audio.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { - userId: query.uid + userId: query.uid, } return request( - 'POST', `https://music.163.com/weapi/djradio/get/byuser`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/djradio/get/byuser`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/user_cloud.js b/module/user_cloud.js index 3261b823035..fc4a8abb0a5 100644 --- a/module/user_cloud.js +++ b/module/user_cloud.js @@ -3,10 +3,12 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, - offset: query.offset || 0 + offset: query.offset || 0, } - return request( - 'POST', `https://music.163.com/weapi/v1/cloud/get`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/v1/cloud/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/user_cloud_del.js b/module/user_cloud_del.js index a00dbda7a07..ce45cba27ba 100644 --- a/module/user_cloud_del.js +++ b/module/user_cloud_del.js @@ -2,11 +2,12 @@ module.exports = (query, request) => { const data = { - songIds: [query.id] - }; + songIds: [query.id], + } return request('POST', `http://music.163.com/weapi/cloud/del`, data, { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy - }); -}; + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/user_cloud_detail.js b/module/user_cloud_detail.js index 6806e1ab3bb..5a2a43c7d32 100644 --- a/module/user_cloud_detail.js +++ b/module/user_cloud_detail.js @@ -1,14 +1,19 @@ // 云盘数据详情 module.exports = (query, request) => { - const id = query.id.replace(/\s/g, '').split(','); + const id = query.id.replace(/\s/g, '').split(',') const data = { - songIds: id - }; + songIds: id, + } return request( 'POST', `https://music.163.com/weapi/v1/cloud/get/byids`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/user_detail.js b/module/user_detail.js index 4e497bd4b78..8822347703c 100644 --- a/module/user_detail.js +++ b/module/user_detail.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/v1/user/detail/${query.uid}`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/v1/user/detail/${query.uid}`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/user_dj.js b/module/user_dj.js index 4edd2f52ad1..87dd5fdba20 100644 --- a/module/user_dj.js +++ b/module/user_dj.js @@ -3,10 +3,17 @@ module.exports = (query, request) => { const data = { limit: query.limit || 30, - offset: query.offset || 0 + offset: query.offset || 0, } return request( - 'POST', `https://music.163.com/weapi/dj/program/${query.uid}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/dj/program/${query.uid}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/user_event.js b/module/user_event.js index ddc46429491..75252cf69d0 100644 --- a/module/user_event.js +++ b/module/user_event.js @@ -5,12 +5,17 @@ module.exports = (query, request) => { getcounts: true, time: query.lasttime || -1, limit: query.limit || 30, - total: false - }; + total: false, + } return request( 'POST', `https://music.163.com/weapi/event/get/${query.uid}`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } - ); -}; + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } + ) +} diff --git a/module/user_followeds.js b/module/user_followeds.js index 4ea0f1d4bd0..078e30b75f6 100644 --- a/module/user_followeds.js +++ b/module/user_followeds.js @@ -4,8 +4,8 @@ module.exports = (query, request) => { const data = { userId: query.uid, time: query.lasttime || -1, - limit: query.limit || 30 - }; + limit: query.limit || 30, + } return request( 'POST', `https://music.163.com/eapi/user/getfolloweds/${query.uid}`, @@ -14,7 +14,8 @@ module.exports = (query, request) => { crypto: 'eapi', cookie: query.cookie, proxy: query.proxy, - url: '/api/user/getfolloweds' + url: '/api/user/getfolloweds', + realIP: query.realIP, } - ); -}; + ) +} diff --git a/module/user_follows.js b/module/user_follows.js index 1538f3b3c53..a6e085bac32 100644 --- a/module/user_follows.js +++ b/module/user_follows.js @@ -4,10 +4,17 @@ module.exports = (query, request) => { const data = { offset: query.offset || 0, limit: query.limit || 30, - order: true + order: true, } return request( - 'POST', `https://music.163.com/weapi/user/getfollows/${query.uid}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/user/getfollows/${query.uid}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/user_playlist.js b/module/user_playlist.js index 215552ce91a..5caacea729c 100644 --- a/module/user_playlist.js +++ b/module/user_playlist.js @@ -4,10 +4,12 @@ module.exports = (query, request) => { const data = { uid: query.uid, limit: query.limit || 30, - offset: query.offset || 0 + offset: query.offset || 0, } - return request( - 'POST', `https://music.163.com/weapi/user/playlist`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/user/playlist`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/user_record.js b/module/user_record.js index ecdf3719bdc..8f5f2cc0a95 100644 --- a/module/user_record.js +++ b/module/user_record.js @@ -3,10 +3,12 @@ module.exports = (query, request) => { const data = { uid: query.uid, - type: query.type || 0 // 1: 最近一周, 0: 所有时间 + type: query.type || 0, // 1: 最近一周, 0: 所有时间 } - return request( - 'POST', `https://music.163.com/weapi/v1/play/record`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + return request('POST', `https://music.163.com/weapi/v1/play/record`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/user_subcount.js b/module/user_subcount.js index 8f564fe97b7..bebe81c242a 100644 --- a/module/user_subcount.js +++ b/module/user_subcount.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/subcount`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/subcount`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/user_update.js b/module/user_update.js index 789ace2a2a0..cbb1f4f52ea 100644 --- a/module/user_update.js +++ b/module/user_update.js @@ -8,10 +8,17 @@ module.exports = (query, request) => { gender: query.gender, nickname: query.nickname, province: query.province, - signature: query.signature + signature: query.signature, } return request( - 'POST', `https://music.163.com/weapi/user/profile/update`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/user/profile/update`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/video_category_list.js b/module/video_category_list.js index d5b9a4d2ac0..530e1d6e19f 100644 --- a/module/video_category_list.js +++ b/module/video_category_list.js @@ -5,7 +5,7 @@ module.exports = (query, request) => { offset: query.offset || 0, total: 'true', limit: query.limit || 99, - }; + } return request( 'POST', `https://music.163.com/api/cloudvideo/category/list`, @@ -13,8 +13,8 @@ module.exports = (query, request) => { { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy + proxy: query.proxy, + realIP: query.realIP, } - ); -}; - \ No newline at end of file + ) +} diff --git a/module/video_detail.js b/module/video_detail.js index a181205a006..9e748f66e9b 100644 --- a/module/video_detail.js +++ b/module/video_detail.js @@ -2,10 +2,17 @@ module.exports = (query, request) => { const data = { - id: query.id + id: query.id, } return request( - 'POST', `https://music.163.com/weapi/cloudvideo/v1/video/detail`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/cloudvideo/v1/video/detail`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/video_detail_info.js b/module/video_detail_info.js index b8338ffef54..f5de495cd1d 100644 --- a/module/video_detail_info.js +++ b/module/video_detail_info.js @@ -2,11 +2,18 @@ module.exports = (query, request) => { const data = { - 'threadid': `R_VI_62_${query.vid}`, - 'composeliked': true + threadid: `R_VI_62_${query.vid}`, + composeliked: true, } return request( - 'POST', `https://music.163.com/api/comment/commentthread/info`, data, - { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + 'POST', + `https://music.163.com/api/comment/commentthread/info`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/video_group.js b/module/video_group.js index b415341c462..ef8f20e7526 100644 --- a/module/video_group.js +++ b/module/video_group.js @@ -5,13 +5,17 @@ module.exports = (query, request) => { groupId: query.id, offset: query.offset || 0, need_preview_url: 'true', - total: true + total: true, } return request( - 'POST', `https://music.163.com/api/videotimeline/videogroup/otherclient/get`, data, { + 'POST', + `https://music.163.com/api/videotimeline/videogroup/otherclient/get`, + data, + { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy + proxy: query.proxy, + realIP: query.realIP, } ) } diff --git a/module/video_group_list.js b/module/video_group_list.js index 23e24ec1557..6d6630f0486 100644 --- a/module/video_group_list.js +++ b/module/video_group_list.js @@ -1,8 +1,7 @@ // 视频标签列表 module.exports = (query, request) => { - const data = { - }; + const data = {} return request( 'POST', `https://music.163.com/api/cloudvideo/group/list`, @@ -10,8 +9,8 @@ module.exports = (query, request) => { { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy + proxy: query.proxy, + realIP: query.realIP, } - ); -}; - \ No newline at end of file + ) +} diff --git a/module/video_sub.js b/module/video_sub.js index 9e83a3a9928..eaeb5a73289 100644 --- a/module/video_sub.js +++ b/module/video_sub.js @@ -1,12 +1,19 @@ // 收藏与取消收藏视频 module.exports = (query, request) => { - query.t = (query.t == 1 ? 'sub' : 'unsub') + query.t = query.t == 1 ? 'sub' : 'unsub' const data = { - id: query.id + id: query.id, } return request( - 'POST', `https://music.163.com/weapi/cloudvideo/video/${query.t}`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/cloudvideo/video/${query.t}`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/video_timeline_all.js b/module/video_timeline_all.js index edc32311e8f..2070cfa085d 100644 --- a/module/video_timeline_all.js +++ b/module/video_timeline_all.js @@ -5,14 +5,18 @@ module.exports = (query, request) => { groupId: 0, offset: query.offset || 0, need_preview_url: 'true', - total: true + total: true, } // /api/videotimeline/otherclient/get return request( - 'POST', `https://music.163.com/api/videotimeline/otherclient/get`, data, { + 'POST', + `https://music.163.com/api/videotimeline/otherclient/get`, + data, + { crypto: 'weapi', cookie: query.cookie, - proxy: query.proxy + proxy: query.proxy, + realIP: query.realIP, } ) } diff --git a/module/video_timeline_recommend.js b/module/video_timeline_recommend.js index dcd218c6d99..1ca218abded 100644 --- a/module/video_timeline_recommend.js +++ b/module/video_timeline_recommend.js @@ -6,17 +6,12 @@ module.exports = (query, request) => { filterLives: '[]', withProgramInfo: 'true', needUrl: '1', - resolution: '480' - }; - return request( - 'POST', - `https://music.163.com/api/videotimeline/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy - } - ); -}; - \ No newline at end of file + resolution: '480', + } + return request('POST', `https://music.163.com/api/videotimeline/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/video_url.js b/module/video_url.js index 5a4f544af62..79c2767318e 100644 --- a/module/video_url.js +++ b/module/video_url.js @@ -3,10 +3,17 @@ module.exports = (query, request) => { const data = { ids: '["' + query.id + '"]', - resolution: query.res || 1080 + resolution: query.res || 1080, } return request( - 'POST', `https://music.163.com/weapi/cloudvideo/playurl`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/cloudvideo/playurl`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/module/weblog.js b/module/weblog.js index d44b5815959..bb2162e65d8 100644 --- a/module/weblog.js +++ b/module/weblog.js @@ -2,7 +2,14 @@ module.exports = (query, request) => { return request( - 'POST', `https://music.163.com/weapi/feedback/weblog`, {}, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} + 'POST', + `https://music.163.com/weapi/feedback/weblog`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + } ) -} \ No newline at end of file +} diff --git a/util/request.js b/util/request.js index 0b57d5b5901..b0d3b473c3f 100644 --- a/util/request.js +++ b/util/request.js @@ -39,6 +39,8 @@ const createRequest = (method, url, data, options) => { headers['Content-Type'] = 'application/x-www-form-urlencoded' if (url.includes('music.163.com')) headers['Referer'] = 'https://music.163.com' + if (options.realIP) + headers['X-Real-IP'] = options.realIP // headers['X-Real-IP'] = '118.88.88.88' if (typeof options.cookie === 'object') headers['Cookie'] = Object.keys(options.cookie) From 3c638e5f0af73587e8294ae457b2e52f207956c5 Mon Sep 17 00:00:00 2001 From: a632079 Date: Wed, 5 Aug 2020 02:09:13 +0800 Subject: [PATCH 2/2] feat: optional data in weblog api --- module/weblog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/weblog.js b/module/weblog.js index bb2162e65d8..d012e839e4c 100644 --- a/module/weblog.js +++ b/module/weblog.js @@ -4,7 +4,7 @@ module.exports = (query, request) => { return request( 'POST', `https://music.163.com/weapi/feedback/weblog`, - {}, + query.data || {}, { crypto: 'weapi', cookie: query.cookie,