├── .gitignore
├── .idea
├── caches
│ └── build_file_checksums.ser
├── checkstyle-idea.xml
├── encodings.xml
├── gradle.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── cyl
│ │ └── musicapi
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── cyl
│ │ │ └── musicapi
│ │ │ └── MainActivity.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── cyl
│ └── musicapi
│ ├── ExampleUnitTest.kt
│ └── LeetCode.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── musicapi
├── .gitignore
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── libs
│ └── tbs_sdk_thirdapp_v3.6.0.1310_43612_sharewithdownload_withoutGame_obfs_20180706_163319.jar
├── local.properties
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── cyl
│ │ └── musicapi
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── dist
│ │ │ ├── app.native.js
│ │ │ └── dsbridge.js
│ │ └── musicApi.html
│ ├── java
│ │ └── com
│ │ │ └── cyl
│ │ │ └── musicapi
│ │ │ ├── AjaxHandler.kt
│ │ │ ├── BaseApiImpl.kt
│ │ │ ├── baidu
│ │ │ ├── BaiduApiService.kt
│ │ │ ├── BaiduArtistInfo.kt
│ │ │ ├── BaiduList.kt
│ │ │ ├── BaiduMusicList.kt
│ │ │ ├── BaiduPlayMv.kt
│ │ │ ├── BaiduSearchMerge.kt
│ │ │ ├── BaiduSearchSug.kt
│ │ │ ├── BaiduSongInfo.kt
│ │ │ ├── RadioData.kt
│ │ │ └── Suggestion.kt
│ │ │ ├── bean
│ │ │ ├── ArtistSongsData.kt
│ │ │ ├── ArtistsData.kt
│ │ │ ├── LyricInfo.kt
│ │ │ ├── SearchData.kt
│ │ │ ├── SongComment.kt
│ │ │ ├── SongUrl.kt
│ │ │ └── TopList.kt
│ │ │ ├── dsbridge
│ │ │ ├── CompletionHandler.java
│ │ │ ├── DWebView.java
│ │ │ └── OnReturnValue.java
│ │ │ ├── kugou
│ │ │ ├── KuGouApiService.kt
│ │ │ └── KugouLyric.kt
│ │ │ ├── netease
│ │ │ ├── ArtistsInfo.kt
│ │ │ ├── BannerBean.kt
│ │ │ ├── CatListBean.kt
│ │ │ ├── LoginInfo.kt
│ │ │ ├── Mv.kt
│ │ │ ├── MvComment.kt
│ │ │ ├── MvInfo.kt
│ │ │ ├── NeteaseApiService.kt
│ │ │ ├── NeteasePlaylist.kt
│ │ │ ├── PersonalFM.kt
│ │ │ ├── PersonalizedInfo.kt
│ │ │ ├── RecommendInfo.kt
│ │ │ ├── SearchInfo.kt
│ │ │ ├── TopList.kt
│ │ │ ├── base
│ │ │ │ └── Data.kt
│ │ │ └── video
│ │ │ │ └── VideoGroup.kt
│ │ │ ├── playlist
│ │ │ ├── ApiModel.kt
│ │ │ ├── ErrorInfo.kt
│ │ │ ├── MusicInfo.kt
│ │ │ ├── PlaylistApiService.kt
│ │ │ ├── PlaylistInfo.kt
│ │ │ └── UserInfo.kt
│ │ │ ├── qq
│ │ │ ├── QQApiKey.java
│ │ │ ├── QQApiModel.java
│ │ │ ├── QQApiService.kt
│ │ │ ├── QQApiServiceImpl.java
│ │ │ └── QQLyricInfo.java
│ │ │ └── xiami
│ │ │ ├── XiamiModel.java
│ │ │ ├── XiamiService.java
│ │ │ └── XiamiServiceImpl.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── cyl
│ └── musicapi
│ └── ExampleUnitTest.java
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/caiyonglong/MusicApi/880067a5d6a3e959c613ddff070cc1385a54d71d/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/.idea/checkstyle-idea.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MusicApi
2 |
3 | [](https://jitpack.io/#caiyonglong/musicapi)
4 |
5 | ## 主要功能点
6 |
7 | - 封装网易云、百度音乐、虾米音乐、QQ音乐Api
8 | - 通过[DSBridge for Android](https://github.com/wendux/DSBridge-Android) 解决Android跨域问题,Android端解析调用[js音乐API](https://github.com/sunzongzheng/musicApi)的api
9 | - 增加NeteaseMusicApi接口
10 | - 具体的接口实现请看主项目 [MusicLake](https://github.com/caiyonglong/MusicLake)
11 |
12 | ## DSbridge使用
13 | 通过BaseApiImpl,调用js方法拼接api请求地址,然后AjaxHandler收到请求地址,再通过okhhtp请求,获取返回数据,然后在回到js组装返回数据。最后返回一个json字符串,在BaseApiImpl 回调方法中gson解析成具体对象。
14 |
15 |
16 | ## 更新记录
17 |
18 | - 1.1.4
19 | - 更新字段类型长整型,导致歌单列表数据解析异常问题。
20 | - 1.1.2
21 | - 新增getAllNeteaseTopList、getAllQQTopList、getQQTopList、getTopList接口
22 | - 1.1.1
23 | - 更新netease接口字段解析
24 |
25 |
26 |
27 | ## Usage
28 |
29 | Step 1. Add the JitPack repository to your build file
30 | ```gradle
31 | allprojects {
32 | repositories {
33 | ...
34 | maven { url 'https://jitpack.io' }
35 | }
36 | }
37 | ```
38 | Step 2. Add the dependency
39 |
40 | ```gradle
41 |
42 | dependencies {
43 | implementation 'com.github.caiyonglong:musicapi:1.1.4'
44 | }
45 |
46 | ```
47 |
48 |
49 | ## 提示
50 |
51 | - assets/dist/app.native.js文件更新,同步[sunzongzheng/musicApi/dist/app.native.js](https://github.com/sunzongzheng/musicApi/blob/master/dist/app.native.js)
52 |
53 |
54 |
55 | ## API
56 |
57 | - 百度音乐Api接口定义 : BaiduApiService(具体实现在MusicLake)
58 |
59 | - 网易音乐Api接口定义 : NeteaseApiService(具体实现在MusicLake)
60 |
61 | - 在线歌单Api接口定义 : PlaylistApiService(具体实现在MusicLake)
62 |
63 | - 音乐播放Api接口[app.native.js](musicapi/src/main/assets/dist/app.native.js) : 同PC端Api接口[sunzongzheng/musicApi/dist/app.native.js](https://github.com/sunzongzheng/musicApi/blob/master/dist/app.native.js)
64 | 为了节省时间,减少维护成本,PC端和Android端使用同一api js,使用 DSbridge 解决Android跨域问题, 实现Android js交互
65 |
66 | - **BaseApiImpl**接口详情:
67 |
68 | - 搜索
69 | ```
70 | /**
71 | * 搜索
72 | *
73 | * @param query 搜索文本
74 | * @param limit 每页多少歌曲
75 | * @param offset 偏移量
76 | * @param success 结果返回回调
77 | * @param fail 失败返回回调
78 | */
79 | fun searchSong(query: String, limit: Int, offset: Int, success: (result: SearchData) -> Unit, fail: ((String?) -> Unit)? = null) {
80 | .....
81 | }
82 | ```
83 | - 按歌曲类型搜索
84 | ```
85 | /**
86 | * 独立请求
87 | * @param query 搜索文本
88 | * @param type 歌曲类型 [QQ,XIAMI,NETEASE]
89 | * @param limit 每页多少歌曲
90 | * @param offset 偏移量
91 | * @param success 结果返回回调
92 | */
93 | fun searchSongSingle(query: String, type: String, limit: Int, offset: Int, success: (result: SearchSingleData) -> Unit) {
94 | .....
95 | }
96 | ```
97 | - 获取歌曲详情
98 | ```
99 | /**
100 | * 获取歌曲详情
101 | * @param vendor 歌曲类型 [qq,xiami,netease]
102 | * @param id 歌曲Id
103 | * @param success 结果返回回调
104 | * @param fail 失败返回回调
105 | */
106 | fun getSongDetail(vendor: String, id: String, success: (result: SongDetail) -> Unit, fail: (() -> Unit)? = null) {
107 | .....
108 | }
109 | ```
110 | - 批量获取歌曲详情
111 | ```
112 | /**
113 | * 批量获取歌曲详情
114 | *
115 | * @param vendor 歌曲类型 [qq,xiami,netease]
116 | * @param ids 歌曲Ids [101126,16435051,139808]
117 | * @param success 成功回调
118 | */
119 | fun getBatchSongDetail(vendor: String, ids: Array, success: (result: BatchSongDetail) -> Unit) {
120 | .....
121 | }
122 | ```
123 | - 获取歌词信息
124 | ```
125 | /**
126 | * 获取歌词信息
127 | *
128 | * @param vendor 歌曲类型 [qq,xiami,netease]
129 | * @param success 成功回调
130 | */
131 | fun getLyricInfo(vendor: String, id: String, success: (result: LyricData) -> Unit) {
132 | .....
133 | }
134 | ```
135 | - 获取评论信息
136 | ```
137 | /**
138 | * 获取评论信息
139 | *
140 | * @param vendor 歌曲类型 [qq,xiami,netease]
141 | * @param id 歌曲Id
142 | * @param success 成功回调
143 | */
144 | fun getComment(vendor: String, id: String, success: (result: Any) -> Unit, fail: ((String) -> Unit)? = null) {
145 | .....
146 | }
147 | ```
148 | - 获取播放地址
149 | ```
150 | /**
151 | * 获取播放地址
152 | * @param vendor 歌曲类型 [qq,xiami,netease]
153 | * @param id 歌曲Id
154 | * @param br 音质 默认12800
155 | * @param success 成功回调
156 | * @param fail 失败回调
157 | */
158 | fun getSongUrl(vendor: String, id: String, br: Int = 128000, success: (result: SongBean) -> Unit, fail: (() -> Unit)? = null) {
159 | .....
160 | }
161 | ```
162 | - 获取歌手单曲列表
163 | ```
164 | /**
165 | * 获取歌手单曲列表
166 | * @param vendor 歌曲类型 [qq,xiami,netease]
167 | * @param id 歌手ID
168 | * @param offset 偏移量
169 | * @param limit 每页限制
170 | * @param success 成功回调
171 | * @param fail 失败回调
172 | */
173 | fun getArtistSongs(vendor: String, id: String, offset: Int, limit: Int, success: (result: ArtistSongsData) -> Unit, fail: ((String) -> Unit)? = null) {
174 | .....
175 | }
176 | ```
177 | - 获取歌单详情
178 | ```
179 | /**
180 | * 获取歌单歌曲列表
181 | * @param vendor 歌曲类型 [qq,xiami,netease]
182 | * @param id 专辑ID
183 | * @param success 成功回调
184 | * @param fail 失败回调
185 | */
186 | fun getPlaylistDetail(vendor: String, id: String, success: (result: ArtistSongs) -> Unit, fail: ((String) -> Unit)? = null) {
187 | ...
188 | }
189 | ```
190 | - 获取专辑详情
191 | ```
192 | /**
193 | * 获取专辑详情
194 | * @param vendor 歌曲类型 [qq,xiami,netease]
195 | * @param id 专辑ID
196 | * @param success 成功回调
197 | * @param fail 失败回调
198 | */
199 | fun getAlbumDetail(vendor: String, id: String, success: (result: AlbumData) -> Unit, fail: ((String) -> Unit)? = null) {
200 | .....
201 | }
202 | ```
203 | - 获取歌手列表详情
204 | ```
205 | /**
206 | * 获取歌手列表详情(qq歌手列表)
207 | * @param offset 偏移量
208 | * @param params 例:val params = mapOf("area" to area, "sex" to sex, "genre" to genre, "index" to index)
209 | * @param success 成功回调
210 | * @param fail 失败回调
211 | */
212 | fun getArtists(offset: Int, params: Any, success: (result: ArtistsData) -> Unit, fail: ((String) -> Unit)? = null) {
213 | .....
214 | }
215 | ```
216 | - 获取任意平台歌手详情
217 | ```
218 | /**
219 | * 获取任意平台歌手详情
220 | * id,专辑ID
221 | * @param ids 歌手ID列表 map(id,vendor) 歌手id 和 歌曲类型 [qq,xiami,netease]
222 | * @param success 成功回调
223 | * @param fail 失败回调
224 | */
225 | fun getAnyVendorSongDetail(ids: MutableList