├── .gitignore
├── .idea
├── .gitignore
├── NeteaseCloudMusicApiWithGo.iml
├── misc.xml
├── modules.xml
└── vcs.xml
├── LICENSE.md
├── README.md
├── api
├── activate.go
├── album.go
├── artist.go
├── banner.go
├── batch.go
├── captcha.go
├── cellphone.go
├── check.go
├── comment.go
├── country.go
├── daily.go
├── dj.go
├── event.go
├── fm.go
├── follow.go
├── history.go
├── home.go
├── hot.go
├── like.go
├── login.go
├── lyric.go
├── main.go
├── msg.go
├── mv.go
├── personal.go
├── playlist.go
├── playmode.go
├── program.go
├── rebind.go
├── recommend.go
├── register.go
├── related.go
├── resource.go
├── scrobble.go
├── search.go
├── send.go
├── share.go
├── simi.go
├── song.go
├── top.go
├── toplist.go
├── user.go
└── video.go
├── auth
└── .keep
├── cache
└── main.go
├── conf
├── conf.go
├── i18n.go
└── locales
│ └── zh-cn.yaml
├── go.mod
├── main.go
├── middleware
├── auth.go
├── cors.go
└── session.go
├── model
├── init.go
├── migration.go
└── user.go
├── serializer
├── common.go
└── user.go
├── server
└── router.go
├── service
├── RegisterCellphoneService.go
├── activate_init_profile_service.go
├── album_detail_dynamic_service.go
├── album_detail_service.go
├── album_list_service.go
├── album_list_style_service.go
├── album_new_service.go
├── album_service.go
├── album_songsaleboard_service.go
├── album_sub_service.go
├── album_sublist_service.go
├── artist_album_service.go
├── artist_desc_service.go
├── artist_list_service.go
├── artist_mv_service.go
├── artist_songs_service.go
├── artist_sub_service.go
├── artist_sublist_service.go
├── artist_top_song_service.go
├── artists_service.go
├── banner_service.go
├── batch_service.go
├── captcha_sent_service.go
├── captcha_verify_service.go
├── cellphone_existence_check_service.go
├── check_music_service.go
├── comment_album_service.go
├── comment_dj_service.go
├── comment_event_service.go
├── comment_floor_service.go
├── comment_hot_service.go
├── comment_hotwall_list_service.go
├── comment_like_service.go
├── comment_music_service.go
├── comment_mv_service.go
├── comment_playlist_service.go
├── comment_service.go
├── comment_video_service.go
├── countries_code_list_service.go
├── daily_signin_service.go
├── digitalAlbum_ordering_service.go
├── digital_album_purchased_service.go
├── dj_banner_service.go
├── dj_category_excludehot_service.go
├── dj_category_recommend_service.go
├── dj_catelist_service.go
├── dj_detail_service.go
├── dj_hot_service.go
├── dj_paygift_service.go
├── dj_program_detail_service.go
├── dj_program_service.go
├── dj_program_toplist_hours_service.go
├── dj_program_toplist_service.go
├── dj_radio_hot_service.go
├── dj_recommend_service.go
├── dj_recommend_type_service.go
├── dj_sub_service.go
├── dj_sublist_service.go
├── dj_today_perfered_service.go
├── dj_toplist_newcomer_service.go
├── dj_toplist_pay_service.go
├── dj_toplist_popular_service.go
├── dj_toplist_service.go
├── dj_toplist_sours_service.go
├── event_del_service.go
├── event_forward_service.go
├── event_service.go
├── fm_trash_service.go
├── follow_service.go
├── history_recommend_dongs_detail_service.go
├── history_recommend_songs_service.go
├── homepage_block_page_service.go
├── homepage_dragon_ball_service.go
├── hot_topic_service.go
├── like_list_service.go
├── like_service.go
├── login_cellphone_service.go
├── login_email_service.go
├── login_refresh_service.go
├── login_status_service.go
├── logout_service.go
├── lyric_service.go
├── msg_comments_service.go
├── msg_forwards_service.go
├── msg_notices_service.go
├── msg_private_history_service.go
├── msg_private_service.go
├── mv_all_service.go
├── mv_detailInfo_service.go
├── mv_detail_service.go
├── mv_exclusive_rcmd_service.go
├── mv_first_service.go
├── mv_sub_service.go
├── mv_sublist_service.go
├── mv_url_service.go
├── personal_fm_service.go
├── personalized_djprogram_service.go
├── personalized_mv_service.go
├── personalized_newsong_service.go
├── personalized_privatecontent_list_service.go
├── personalized_privatecontent_service.go
├── personalized_service.go
├── playlist_catlist_service.go
├── playlist_create_service.go
├── playlist_delete_service.go
├── playlist_desc_update_service.go
├── playlist_detail_service.go
├── playlist_hot_service.go
├── playlist_name_update_service.go
├── playlist_order_update_service.go
├── playlist_subscribe_service.go
├── playlist_subscribers_service.go
├── playlist_tags_update_service.go
├── playlist_tracks_service.go
├── playlist_update_service.go
├── playmode_intelligence_list_service.go
├── program_recommend_service.go
├── rebind_service.go
├── recommend_resource_service.go
├── recommend_songs_service.go
├── related_all_video_service.go
├── related_playlist_service.go
├── resource_like_service.go
├── scrobble_service.go
├── search_default_service.go
├── search_hot_detail_service.go
├── search_hot_service.go
├── search_multimatch_service.go
├── search_service.go
├── search_suggest_service.go
├── send_playlist_service.go
├── send_text_service.go
├── setting_service.go
├── share_resource_service.go
├── simi_artist_service.go
├── simi_mv_service.go
├── simi_playlist_service.go
├── simi_song_service.go
├── simi_user_service.go
├── song_detail_service.go
├── song_order_update_service.go
├── song_url_service.go
├── top_album_service.go
├── top_artists_service.go
├── top_mv_service.go
├── top_playlist_highquality_service.go
├── top_playlist_service.go
├── top_song_service.go
├── toplist_artist_service.go
├── toplist_detail_service.go
├── toplist_service.go
├── user_audio_service.go
├── user_cloud_del_service.go
├── user_cloud_detail_service.go
├── user_cloud_service.go
├── user_detail_service.go
├── user_dj_service.go
├── user_event_service.go
├── user_followeds_service.go
├── user_follows_service.go
├── user_playlist_service.go
├── user_record_service.go
├── user_subcount_service.go
├── user_update_service.go
├── video_category_list_service.go
├── video_detail_info_service.go
├── video_detail_service.go
├── video_group_list_service.go
├── video_group_service.go
├── video_sub_service.go
├── video_timeline_all__service.go
├── video_timeline_recommend_service.go
└── video_url_service.go
└── util
├── common.go
├── cryto.go
├── logger.go
└── request.go
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | .env
3 | go.sum
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /workspace.xml
--------------------------------------------------------------------------------
/.idea/NeteaseCloudMusicApiWithGo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-2017 GitHub Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NeteaseCloudMusicApiWithGo
2 |
3 | 本项目基于[网易云音乐 API](https://github.com/Binaryify/NeteaseCloudMusicApi) 重新用golang实现
4 | 网易云api Golng 版 ~~(持续更新)~~
5 | [开发详解](https://blog.xiaosiro.cn/posts/NeteaseCloudMusicApiWithGo)
6 |
7 | ## 功能特性
8 | 1. 登录
9 | 2. 刷新登录
10 | 3. 发送验证码
11 | 4. 校验验证码
12 | 5. 注册(修改密码)
13 | 6. 。。。等160多个api
14 |
15 | ## 环境要求
16 |
17 | 需要 Golang 1.6以上 环境
18 |
19 |
20 | ## 运行
21 |
22 | ```shell
23 | go run main.go
24 | ```
25 |
26 | ## 使用文档(为binaryify大佬的文档)
27 |
28 | [文档地址](https://binaryify.github.io/NeteaseCloudMusicApi)
29 |
30 | [文档地址2](https://neteasecloudmusicapi.vercel.app)
31 |
32 | ## Go Mod
33 |
34 | 本项目使用[Go Mod](https://github.com/golang/go/wiki/Modules)管理依赖。
35 |
36 | ```shell
37 | go mod init singo
38 | export GOPROXY=http://mirrors.aliyun.com/goproxy/
39 | go run main.go // 自动安装
40 | ```
41 |
42 |
43 | 项目运行后启动在3333端口(可以修改,参考gin文档)
44 |
--------------------------------------------------------------------------------
/api/activate.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 注册后初始化昵称
9 | func ActivateInitProfile(c *gin.Context) {
10 | var service service.ActivateInitProfileService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.ActivateInitProfile(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/banner.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func Banner(c *gin.Context) {
9 | var service service.BannerService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.Banner(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/batch.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func Batch(c *gin.Context) {
9 | var service service.BatchService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.Batch(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/captcha.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 发送验证码
9 | func CaptchaSent(c *gin.Context) {
10 | var service service.CaptchaSentService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.CaptchaSent(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 验证验证码
20 | func CaptchaVerify(c *gin.Context) {
21 | var service service.CaptchaVerifyService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.CaptchaVerify(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/api/cellphone.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 检查手机是否已经注册
9 | func CellphoneExistenceCheck(c *gin.Context) {
10 | var service service.CellphoneExistenceCheckService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.CellphoneExistenceCheck(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/check.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func CheckMusic(c *gin.Context) {
9 | var service service.CheckMusicService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.CheckMusic(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/country.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 国家编码列表
9 | func CountriesCodeList(c *gin.Context) {
10 | var service service.CountriesCodeListService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.CountriesCodeList(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/daily.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 签到
9 | func DailySignin(c *gin.Context) {
10 | var service service.DailySigninService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.DailySignin(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/event.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 转发动态
9 | func EventForward(c *gin.Context) {
10 | var service service.EventForwardService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.EventForward(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 删除动态
20 | func EventDel(c *gin.Context) {
21 | var service service.EventDelService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.EventDel(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
30 | // 获取动态列表(网页版)
31 | func Event(c *gin.Context) {
32 | var service service.EventService
33 | if err := c.ShouldBind(&service); err == nil {
34 | res := service.Event(c)
35 | c.JSON(200, res)
36 | } else {
37 | c.JSON(200, ErrorResponse(err))
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/api/fm.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func FmTrash(c *gin.Context) {
9 | var service service.FmTrashService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.FmTrash(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/follow.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func Follow(c *gin.Context) {
9 | var service service.FollowService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.Follow(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/history.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func HistoryRecommendSongs(c *gin.Context) {
9 | var service service.HistoryRecommendSongsService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.HistoryRecommendSongs(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
18 | // 历史推荐详情
19 | func HistoryRecommendDongsDetail(c *gin.Context) {
20 | var service service.HistoryRecommendDongsDetailService
21 | if err := c.ShouldBind(&service); err == nil {
22 | res := service.HistoryRecommendDongsDetail(c)
23 | c.JSON(200, res)
24 | } else {
25 | c.JSON(200, ErrorResponse(err))
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/api/home.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 首页-发现 block page
9 | // 这个接口为移动端接口,首页-发现页,数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L259 HomeBlockPageWrap
10 | // query.refresh 是否刷新数据
11 | func HomepageBlockPage(c *gin.Context) {
12 | var service service.HomepageBlockPageService
13 | if err := c.ShouldBind(&service); err == nil {
14 | res := service.HomepageBlockPage(c)
15 | c.JSON(200, res)
16 | } else {
17 | c.JSON(200, ErrorResponse(err))
18 | }
19 | }
20 |
21 | // 首页-发现 dragon ball
22 | // 这个接口为移动端接口,首页-发现页(每日推荐、歌单、排行榜 那些入口)
23 | // 数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L290 HomeDragonBallWrap
24 | // !需要登录或者匿名登录,非登录返回 []
25 | func HomepageDragonBall(c *gin.Context) {
26 | var service service.HomepageDragonBallService
27 | if err := c.ShouldBind(&service); err == nil {
28 | res := service.HomepageDragonBall(c)
29 | c.JSON(200, res)
30 | } else {
31 | c.JSON(200, ErrorResponse(err))
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/api/hot.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 热门话题
9 | func HotTopic(c *gin.Context) {
10 | var service service.HotTopicService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.HotTopic(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/like.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 喜欢一首歌曲
9 | func Like(c *gin.Context) {
10 | var service service.LikeService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.Like(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 获取喜欢歌曲列表
20 | func LikeList(c *gin.Context) {
21 | var service service.LikeListService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.LikeList(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/api/login.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 获取登录状态
9 | func LoginStatus(c *gin.Context) {
10 | var service service.LoginStatusService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.LoginStatus(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 手机登录
20 | func LoginCellphone(c *gin.Context) {
21 | var service service.LoginCellphoneService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.LoginCellphone(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
30 | // 邮箱登录
31 | func LoginEmail(c *gin.Context) {
32 | var service service.LoginEmailService
33 | if err := c.ShouldBind(&service); err == nil {
34 | res := service.LoginEmail(c)
35 | c.JSON(200, res)
36 | } else {
37 | c.JSON(200, ErrorResponse(err))
38 | }
39 | }
40 |
41 | // 刷新登录
42 | func LoginRefresh(c *gin.Context) {
43 | var service service.LoginRefreshService
44 | if err := c.ShouldBind(&service); err == nil {
45 | res := service.LoginRefresh(c)
46 | c.JSON(200, res)
47 | } else {
48 | c.JSON(200, ErrorResponse(err))
49 | }
50 | }
51 |
52 | // 退出登录
53 | func Logout(c *gin.Context) {
54 | var service service.LogoutService
55 | if err := c.ShouldBind(&service); err == nil {
56 | res := service.Logout(c)
57 | c.JSON(200, res)
58 | } else {
59 | c.JSON(200, ErrorResponse(err))
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/api/lyric.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 获取歌词
9 | func Lyric(c *gin.Context) {
10 | var service service.LyricService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.Lyric(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/main.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "singo/conf"
7 | "singo/model"
8 | "singo/serializer"
9 |
10 | "github.com/gin-gonic/gin"
11 | validator "gopkg.in/go-playground/validator.v8"
12 | )
13 |
14 | // Ping 状态检查页面
15 | func Ping(c *gin.Context) {
16 | c.JSON(200, serializer.Response{
17 | Code: 0,
18 | Msg: "Pong",
19 | })
20 | }
21 |
22 | // CurrentUser 获取当前用户
23 | func CurrentUser(c *gin.Context) *model.User {
24 | if user, _ := c.Get("user"); user != nil {
25 | if u, ok := user.(*model.User); ok {
26 | return u
27 | }
28 | }
29 | return nil
30 | }
31 |
32 | // ErrorResponse 返回错误消息
33 | func ErrorResponse(err error) serializer.Response {
34 | if ve, ok := err.(validator.ValidationErrors); ok {
35 | for _, e := range ve {
36 | field := conf.T(fmt.Sprintf("Field.%s", e.Field))
37 | tag := conf.T(fmt.Sprintf("Tag.Valid.%s", e.Tag))
38 | return serializer.ParamErr(
39 | fmt.Sprintf("%s%s", field, tag),
40 | err,
41 | )
42 | }
43 | }
44 | if _, ok := err.(*json.UnmarshalTypeError); ok {
45 | return serializer.ParamErr("JSON类型不匹配", err)
46 | }
47 |
48 | return serializer.ParamErr("参数错误", err)
49 | }
50 |
--------------------------------------------------------------------------------
/api/msg.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 通知-私信
9 | func MsgPrivate(c *gin.Context) {
10 | var service service.MsgPrivateService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.MsgPrivate(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 私信内容
20 | func MsgPrivateHistory(c *gin.Context) {
21 | var service service.MsgPrivateHistoryService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.MsgPrivateHistory(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
30 | // 通知-评论
31 | func MsgComments(c *gin.Context) {
32 | var service service.MsgCommentsService
33 | if err := c.ShouldBind(&service); err == nil {
34 | res := service.MsgComments(c)
35 | c.JSON(200, res)
36 | } else {
37 | c.JSON(200, ErrorResponse(err))
38 | }
39 | }
40 |
41 | // 通知-@我
42 | func MsgForwards(c *gin.Context) {
43 | var service service.MsgForwardsService
44 | if err := c.ShouldBind(&service); err == nil {
45 | res := service.MsgForwards(c)
46 | c.JSON(200, res)
47 | } else {
48 | c.JSON(200, ErrorResponse(err))
49 | }
50 | }
51 |
52 | // 通知-通知
53 | func MsgNotices(c *gin.Context) {
54 | var service service.MsgNoticesService
55 | if err := c.ShouldBind(&service); err == nil {
56 | res := service.MsgNotices(c)
57 | c.JSON(200, res)
58 | } else {
59 | c.JSON(200, ErrorResponse(err))
60 | }
61 | }
62 |
63 | // 设置
64 | func Setting(c *gin.Context) {
65 | var service service.SettingService
66 | if err := c.ShouldBind(&service); err == nil {
67 | res := service.Setting(c)
68 | c.JSON(200, res)
69 | } else {
70 | c.JSON(200, ErrorResponse(err))
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/api/playmode.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 心动模式播放列表
9 | func PlaymodeIntelligenceList(c *gin.Context) {
10 | var service service.PlaymodeIntelligenceListService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.PlaymodeIntelligenceList(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/program.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 推荐节目
9 | func ProgramRecommend(c *gin.Context) {
10 | var service service.ProgramRecommendService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.ProgramRecommend(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/rebind.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 重新绑定手机
9 | func Rebind(c *gin.Context) {
10 | var service service.RebindService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.Rebind(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/recommend.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 日推歌单
9 | func RecommendResource(c *gin.Context) {
10 | var service service.RecommendResourceService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.RecommendResource(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 日推歌曲
20 | func RecommendSongs(c *gin.Context) {
21 | var service service.RecommendSongsService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.RecommendSongs(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/api/register.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 手机注册
9 | func RegisterCellphone(c *gin.Context) {
10 | var service service.RegisterCellphoneService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.RegisterCellphone(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/related.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 歌单推荐
9 | func RelatedPlaylist(c *gin.Context) {
10 | var service service.RelatedPlaylistService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.RelatedPlaylist(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 相关视频
20 | func RelatedAllVideo(c *gin.Context) {
21 | var service service.RelatedAllVideoService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.RelatedAllVideo(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/api/resource.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func ResourceLike(c *gin.Context) {
9 | var service service.ResourceLikeService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.ResourceLike(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/scrobble.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func Scrobble(c *gin.Context) {
9 | var service service.ScrobbleService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.Scrobble(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/search.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 搜索
9 | func Search(c *gin.Context) {
10 | var service service.SearchService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.Search(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 默认搜索关键词
20 | func SearchDefault(c *gin.Context) {
21 | var service service.SearchDefaultService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.SearchDefault(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
30 | // 热门搜索关键词
31 | func SearchHot(c *gin.Context) {
32 | var service service.SearchHotService
33 | if err := c.ShouldBind(&service); err == nil {
34 | res := service.SearchHot(c)
35 | c.JSON(200, res)
36 | } else {
37 | c.JSON(200, ErrorResponse(err))
38 | }
39 | }
40 |
41 | // 热搜列表(详细)
42 | func SearchHotDetail(c *gin.Context) {
43 | var service service.SearchHotDetailService
44 | if err := c.ShouldBind(&service); err == nil {
45 | res := service.SearchHotDetail(c)
46 | c.JSON(200, res)
47 | } else {
48 | c.JSON(200, ErrorResponse(err))
49 | }
50 | }
51 |
52 | // 搜索建议
53 | func SearchSuggest(c *gin.Context) {
54 | var service service.SearchSuggestService
55 | if err := c.ShouldBind(&service); err == nil {
56 | res := service.SearchSuggest(c)
57 | c.JSON(200, res)
58 | } else {
59 | c.JSON(200, ErrorResponse(err))
60 | }
61 | }
62 |
63 | // 多重搜索
64 | func SearchMultimatch(c *gin.Context) {
65 | var service service.SearchMultimatchService
66 | if err := c.ShouldBind(&service); err == nil {
67 | res := service.SearchMultimatch(c)
68 | c.JSON(200, res)
69 | } else {
70 | c.JSON(200, ErrorResponse(err))
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/api/send.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func SendText(c *gin.Context) {
9 | var service service.SendTextService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.SendText(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
18 | // 发生带歌单的私信
19 | func SendPlaylist(c *gin.Context) {
20 | var service service.SendPlaylistService
21 | if err := c.ShouldBind(&service); err == nil {
22 | res := service.SendPlaylist(c)
23 | c.JSON(200, res)
24 | } else {
25 | c.JSON(200, ErrorResponse(err))
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/api/share.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 分享xxx到动态
9 | func ShareResource(c *gin.Context) {
10 | var service service.ShareResourceService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.ShareResource(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/api/simi.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | func SimiArtist(c *gin.Context) {
9 | var service service.SimiArtistService
10 | if err := c.ShouldBind(&service); err == nil {
11 | res := service.SimiArtist(c)
12 | c.JSON(200, res)
13 | } else {
14 | c.JSON(200, ErrorResponse(err))
15 | }
16 | }
17 |
18 | // 相似歌单
19 | func SimiPlaylist(c *gin.Context) {
20 | var service service.SimiPlaylistService
21 | if err := c.ShouldBind(&service); err == nil {
22 | res := service.SimiPlaylist(c)
23 | c.JSON(200, res)
24 | } else {
25 | c.JSON(200, ErrorResponse(err))
26 | }
27 | }
28 |
29 | // 相似MV
30 | func SimiMv(c *gin.Context) {
31 | var service service.SimiMvService
32 | if err := c.ShouldBind(&service); err == nil {
33 | res := service.SimiMv(c)
34 | c.JSON(200, res)
35 | } else {
36 | c.JSON(200, ErrorResponse(err))
37 | }
38 | }
39 |
40 | // 相似歌手
41 | func SimiSong(c *gin.Context) {
42 | var service service.SimiSongService
43 | if err := c.ShouldBind(&service); err == nil {
44 | res := service.SimiSong(c)
45 | c.JSON(200, res)
46 | } else {
47 | c.JSON(200, ErrorResponse(err))
48 | }
49 | }
50 |
51 | // 获取最近 5 个听了这首歌的用户
52 | func SimiUser(c *gin.Context) {
53 | var service service.SimiUserService
54 | if err := c.ShouldBind(&service); err == nil {
55 | res := service.SimiUser(c)
56 | c.JSON(200, res)
57 | } else {
58 | c.JSON(200, ErrorResponse(err))
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/api/song.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 调整歌曲顺序
9 | func SongOrderUpdate(c *gin.Context) {
10 | var service service.SongOrderUpdateService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.SongOrderUpdate(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 获取音乐的url
20 | func SongUrl(c *gin.Context) {
21 | var service service.SongUrlService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.SongUrl(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
30 | // 获取歌曲详情
31 | func SongDetail(c *gin.Context) {
32 | var service service.SongDetailService
33 | if err := c.ShouldBind(&service); err == nil {
34 | res := service.SongDetail(c)
35 | c.JSON(200, res)
36 | } else {
37 | c.JSON(200, ErrorResponse(err))
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/api/top.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 歌单 ( 网友精选碟 )
9 | func TopPlaylist(c *gin.Context) {
10 | var service service.TopPlaylistService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.TopPlaylist(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 精选歌单
20 | func TopPlaylistHighquality(c *gin.Context) {
21 | var service service.TopPlaylistHighqualityService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.TopPlaylistHighquality(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
30 | // 新歌速递
31 | func TopSong(c *gin.Context) {
32 | var service service.TopSongService
33 | if err := c.ShouldBind(&service); err == nil {
34 | res := service.TopSong(c)
35 | c.JSON(200, res)
36 | } else {
37 | c.JSON(200, ErrorResponse(err))
38 | }
39 | }
40 |
41 | // 新碟上架
42 | func TopAlbum(c *gin.Context) {
43 | var service service.TopAlbumService
44 | if err := c.ShouldBind(&service); err == nil {
45 | res := service.TopAlbum(c)
46 | c.JSON(200, res)
47 | } else {
48 | c.JSON(200, ErrorResponse(err))
49 | }
50 | }
51 |
52 | // 热门歌手
53 | func TopArtists(c *gin.Context) {
54 | var service service.TopArtistsService
55 | if err := c.ShouldBind(&service); err == nil {
56 | res := service.TopArtists(c)
57 | c.JSON(200, res)
58 | } else {
59 | c.JSON(200, ErrorResponse(err))
60 | }
61 | }
62 |
63 | // mv排行
64 | func TopMv(c *gin.Context) {
65 | var service service.TopMvService
66 | if err := c.ShouldBind(&service); err == nil {
67 | res := service.TopMv(c)
68 | c.JSON(200, res)
69 | } else {
70 | c.JSON(200, ErrorResponse(err))
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/api/toplist.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/service"
6 | )
7 |
8 | // 获取所有榜单
9 | func Toplist(c *gin.Context) {
10 | var service service.ToplistService
11 | if err := c.ShouldBind(&service); err == nil {
12 | res := service.Toplist(c)
13 | c.JSON(200, res)
14 | } else {
15 | c.JSON(200, ErrorResponse(err))
16 | }
17 | }
18 |
19 | // 获取所有绑定内容摘要
20 | func ToplistDetail(c *gin.Context) {
21 | var service service.ToplistDetailService
22 | if err := c.ShouldBind(&service); err == nil {
23 | res := service.ToplistDetail(c)
24 | c.JSON(200, res)
25 | } else {
26 | c.JSON(200, ErrorResponse(err))
27 | }
28 | }
29 |
30 | // 歌手榜
31 | func ToplistArtist(c *gin.Context) {
32 | var service service.ToplistArtistService
33 | if err := c.ShouldBind(&service); err == nil {
34 | res := service.ToplistArtist(c)
35 | c.JSON(200, res)
36 | } else {
37 | c.JSON(200, ErrorResponse(err))
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/auth/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirodeneko/NeteaseCloudMusicApiWithGo/6cebc60164168c1a78d475e4978ccce312140fea/auth/.keep
--------------------------------------------------------------------------------
/cache/main.go:
--------------------------------------------------------------------------------
1 | package cache
2 |
3 | import (
4 | "os"
5 | "singo/util"
6 | "strconv"
7 |
8 | "github.com/go-redis/redis"
9 | )
10 |
11 | // RedisClient Redis缓存客户端单例
12 | var RedisClient *redis.Client
13 |
14 | // Redis 在中间件中初始化redis链接
15 | func Redis() {
16 | db, _ := strconv.ParseUint(os.Getenv("REDIS_DB"), 10, 64)
17 | client := redis.NewClient(&redis.Options{
18 | Addr: os.Getenv("REDIS_ADDR"),
19 | Password: os.Getenv("REDIS_PW"),
20 | DB: int(db),
21 | MaxRetries: 1,
22 | })
23 |
24 | _, err := client.Ping().Result()
25 |
26 | if err != nil {
27 | util.Log().Panic("连接Redis不成功", err)
28 | }
29 |
30 | RedisClient = client
31 | }
32 |
--------------------------------------------------------------------------------
/conf/conf.go:
--------------------------------------------------------------------------------
1 | package conf
2 |
3 | import (
4 | "os"
5 | "singo/util"
6 |
7 | "github.com/joho/godotenv"
8 | )
9 |
10 | // Init 初始化配置项
11 | func Init() {
12 | // 从本地读取环境变量
13 | godotenv.Load()
14 |
15 | // 设置日志级别
16 | util.BuildLogger(os.Getenv("LOG_LEVEL"))
17 |
18 | // 读取翻译文件
19 | if err := LoadLocales("conf/locales/zh-cn.yaml"); err != nil {
20 | util.Log().Panic("翻译文件加载失败", err)
21 | }
22 |
23 | // 连接数据库
24 | //model.Database(os.Getenv("MYSQL_DSN"))
25 | //cache.Redis()
26 | }
27 |
--------------------------------------------------------------------------------
/conf/i18n.go:
--------------------------------------------------------------------------------
1 | package conf
2 |
3 | import (
4 | "io/ioutil"
5 | "strings"
6 |
7 | yaml "gopkg.in/yaml.v2"
8 | )
9 |
10 | // Dictinary 字典
11 | var Dictinary *map[interface{}]interface{}
12 |
13 | // LoadLocales 读取国际化文件
14 | func LoadLocales(path string) error {
15 | data, err := ioutil.ReadFile(path)
16 | if err != nil {
17 | return err
18 | }
19 |
20 | m := make(map[interface{}]interface{})
21 | err = yaml.Unmarshal([]byte(data), &m)
22 | if err != nil {
23 | return err
24 | }
25 |
26 | Dictinary = &m
27 |
28 | return nil
29 | }
30 |
31 | // T 翻译
32 | func T(key string) string {
33 | dic := *Dictinary
34 | keys := strings.Split(key, ".")
35 | for index, path := range keys {
36 | // 如果到达了最后一层,寻找目标翻译
37 | if len(keys) == (index + 1) {
38 | for k, v := range dic {
39 | if k, ok := k.(string); ok {
40 | if k == path {
41 | if value, ok := v.(string); ok {
42 | return value
43 | }
44 | }
45 | }
46 | }
47 | return path
48 | }
49 | // 如果还有下一层,继续寻找
50 | for k, v := range dic {
51 | if ks, ok := k.(string); ok {
52 | if ks == path {
53 | if dic, ok = v.(map[interface{}]interface{}); ok == false {
54 | return path
55 | }
56 | }
57 | } else {
58 | return ""
59 | }
60 | }
61 | }
62 |
63 | return ""
64 | }
65 |
--------------------------------------------------------------------------------
/conf/locales/zh-cn.yaml:
--------------------------------------------------------------------------------
1 | Tag:
2 | required: "必须存在,而且不能为空"
3 | min: "不够长"
4 | max: "太长"
5 | Field:
6 | Name: "名称"
7 | Nickname: "用户昵称"
8 | UserName: "用户名"
9 | Password: "密码"
10 | PasswordConfirm: "密码校验"
11 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module singo
2 |
3 | go 1.12
4 |
5 | require (
6 | github.com/asmcos/requests v0.0.0-20200725080539-508ff1c69720
7 | github.com/forgoer/openssl v0.0.0-20200331032942-ad9f8d57d8b1
8 | github.com/gin-contrib/cors v1.3.0
9 | github.com/gin-contrib/sessions v0.0.0-20190512062852-3cb4c4f2d615
10 | github.com/gin-gonic/gin v1.7.0
11 | github.com/go-redis/redis v6.15.3+incompatible
12 | github.com/jinzhu/gorm v1.9.10
13 | github.com/joho/godotenv v1.3.0
14 | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
15 | gopkg.in/go-playground/validator.v8 v8.18.2
16 | gopkg.in/yaml.v2 v2.2.2
17 | )
18 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "singo/conf"
5 | "singo/server"
6 | )
7 |
8 | func main() {
9 | // 从配置文件读取配置
10 | conf.Init()
11 |
12 | // 装载路由
13 | r := server.NewRouter()
14 | r.Run(":3333")
15 | }
16 |
--------------------------------------------------------------------------------
/middleware/auth.go:
--------------------------------------------------------------------------------
1 | package middleware
2 |
3 | import (
4 | "singo/model"
5 | "singo/serializer"
6 |
7 | "github.com/gin-contrib/sessions"
8 | "github.com/gin-gonic/gin"
9 | )
10 |
11 | // CurrentUser 获取登录用户
12 | func CurrentUser() gin.HandlerFunc {
13 | return func(c *gin.Context) {
14 | session := sessions.Default(c)
15 | uid := session.Get("user_id")
16 | if uid != nil {
17 | user, err := model.GetUser(uid)
18 | if err == nil {
19 | c.Set("user", &user)
20 | }
21 | }
22 | c.Next()
23 | }
24 | }
25 |
26 | // AuthRequired 需要登录
27 | func AuthRequired() gin.HandlerFunc {
28 | return func(c *gin.Context) {
29 | if user, _ := c.Get("user"); user != nil {
30 | if _, ok := user.(*model.User); ok {
31 | c.Next()
32 | return
33 | }
34 | }
35 |
36 | c.JSON(200, serializer.CheckLogin())
37 | c.Abort()
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/middleware/cors.go:
--------------------------------------------------------------------------------
1 | package middleware
2 |
3 | import (
4 | "regexp"
5 |
6 | "github.com/gin-contrib/cors"
7 | "github.com/gin-gonic/gin"
8 | )
9 |
10 | // Cors 跨域配置
11 | func Cors() gin.HandlerFunc {
12 | config := cors.DefaultConfig()
13 | config.AllowMethods = []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}
14 | config.AllowHeaders = []string{"Origin", "Content-Length", "Content-Type", "Cookie","X-Requested-With"}
15 | if gin.Mode() == gin.ReleaseMode {
16 | // 生产环境需要配置跨域域名,否则403
17 | config.AllowOrigins = []string{"http://www.example.com"}
18 | } else {
19 | // 测试环境下模糊匹配本地开头的请求
20 | config.AllowOriginFunc = func(origin string) bool {
21 | if regexp.MustCompile(`^http://127\.0\.0\.1:\d+$`).MatchString(origin) {
22 | return true
23 | }
24 | if regexp.MustCompile(`^http://localhost:\d+$`).MatchString(origin) {
25 | return true
26 | }
27 | return false
28 | }
29 | }
30 | config.AllowCredentials = true
31 | return cors.New(config)
32 | }
33 |
--------------------------------------------------------------------------------
/middleware/session.go:
--------------------------------------------------------------------------------
1 | package middleware
2 |
3 | import (
4 | "github.com/gin-contrib/sessions"
5 | "github.com/gin-contrib/sessions/cookie"
6 | "github.com/gin-gonic/gin"
7 | )
8 |
9 | // Session 初始化session
10 | func Session(secret string) gin.HandlerFunc {
11 | store := cookie.NewStore([]byte(secret))
12 | //Also set Secure: true if using SSL, you should though
13 | store.Options(sessions.Options{HttpOnly: true, MaxAge: 7 * 86400, Path: "/"})
14 | return sessions.Sessions("gin-session", store)
15 | }
16 |
--------------------------------------------------------------------------------
/model/init.go:
--------------------------------------------------------------------------------
1 | package model
2 |
3 | import (
4 | "singo/util"
5 | "time"
6 |
7 | "github.com/jinzhu/gorm"
8 |
9 | //
10 | _ "github.com/jinzhu/gorm/dialects/mysql"
11 | )
12 |
13 | // DB 数据库链接单例
14 | var DB *gorm.DB
15 |
16 | // Database 在中间件中初始化mysql链接
17 | func Database(connString string) {
18 | db, err := gorm.Open("mysql", connString)
19 | db.LogMode(true)
20 | // Error
21 | if err != nil {
22 | util.Log().Panic("连接数据库不成功", err)
23 | }
24 | //设置连接池
25 | //空闲
26 | db.DB().SetMaxIdleConns(50)
27 | //打开
28 | db.DB().SetMaxOpenConns(100)
29 | //超时
30 | db.DB().SetConnMaxLifetime(time.Second * 30)
31 |
32 | DB = db
33 |
34 | migration()
35 | }
36 |
--------------------------------------------------------------------------------
/model/migration.go:
--------------------------------------------------------------------------------
1 | package model
2 |
3 | //执行数据迁移
4 |
5 | func migration() {
6 | // 自动迁移模式
7 | // DB.AutoMigrate(&User{})
8 | }
9 |
--------------------------------------------------------------------------------
/model/user.go:
--------------------------------------------------------------------------------
1 | package model
2 |
3 | import (
4 | "github.com/jinzhu/gorm"
5 | "golang.org/x/crypto/bcrypt"
6 | )
7 |
8 | // User 用户模型
9 | type User struct {
10 | gorm.Model
11 | UserName string
12 | PasswordDigest string
13 | Nickname string
14 | Status string
15 | Avatar string `gorm:"size:1000"`
16 | }
17 |
18 | const (
19 | // PassWordCost 密码加密难度
20 | PassWordCost = 12
21 | // Active 激活用户
22 | Active string = "active"
23 | // Inactive 未激活用户
24 | Inactive string = "inactive"
25 | // Suspend 被封禁用户
26 | Suspend string = "suspend"
27 | )
28 |
29 | // GetUser 用ID获取用户
30 | func GetUser(ID interface{}) (User, error) {
31 | var user User
32 | result := DB.First(&user, ID)
33 | return user, result.Error
34 | }
35 |
36 | // SetPassword 设置密码
37 | func (user *User) SetPassword(password string) error {
38 | bytes, err := bcrypt.GenerateFromPassword([]byte(password), PassWordCost)
39 | if err != nil {
40 | return err
41 | }
42 | user.PasswordDigest = string(bytes)
43 | return nil
44 | }
45 |
46 | // CheckPassword 校验密码
47 | func (user *User) CheckPassword(password string) bool {
48 | err := bcrypt.CompareHashAndPassword([]byte(user.PasswordDigest), []byte(password))
49 | return err == nil
50 | }
51 |
--------------------------------------------------------------------------------
/serializer/common.go:
--------------------------------------------------------------------------------
1 | package serializer
2 |
3 | import "github.com/gin-gonic/gin"
4 |
5 | // Response 基础序列化器
6 | type Response struct {
7 | Code int `json:"code"`
8 | Data interface{} `json:"data,omitempty"`
9 | Msg string `json:"msg"`
10 | Error string `json:"error,omitempty"`
11 | }
12 |
13 | // TrackedErrorResponse 有追踪信息的错误响应
14 | type TrackedErrorResponse struct {
15 | Response
16 | TrackID string `json:"track_id"`
17 | }
18 |
19 | // 三位数错误编码为复用http原本含义
20 | // 五位数错误编码为应用自定义错误
21 | // 五开头的五位数错误编码为服务器端错误,比如数据库操作失败
22 | // 四开头的五位数错误编码为客户端错误,有时候是客户端代码写错了,有时候是用户操作错误
23 | const (
24 | // CodeCheckLogin 未登录
25 | CodeCheckLogin = 401
26 | // CodeNoRightErr 未授权访问
27 | CodeNoRightErr = 403
28 | // CodeDBError 数据库操作失败
29 | CodeDBError = 50001
30 | // CodeEncryptError 加密失败
31 | CodeEncryptError = 50002
32 | //CodeParamErr 各种奇奇怪怪的参数错误
33 | CodeParamErr = 40001
34 | )
35 |
36 | // CheckLogin 检查登录
37 | func CheckLogin() Response {
38 | return Response{
39 | Code: CodeCheckLogin,
40 | Msg: "未登录",
41 | }
42 | }
43 |
44 | // Err 通用错误处理
45 | func Err(errCode int, msg string, err error) Response {
46 | res := Response{
47 | Code: errCode,
48 | Msg: msg,
49 | }
50 | // 生产环境隐藏底层报错
51 | if err != nil && gin.Mode() != gin.ReleaseMode {
52 | res.Error = err.Error()
53 | }
54 | return res
55 | }
56 |
57 | // DBErr 数据库操作失败
58 | func DBErr(msg string, err error) Response {
59 | if msg == "" {
60 | msg = "数据库操作失败"
61 | }
62 | return Err(CodeDBError, msg, err)
63 | }
64 |
65 | // ParamErr 各种参数错误
66 | func ParamErr(msg string, err error) Response {
67 | if msg == "" {
68 | msg = "参数错误"
69 | }
70 | return Err(CodeParamErr, msg, err)
71 | }
72 |
--------------------------------------------------------------------------------
/serializer/user.go:
--------------------------------------------------------------------------------
1 | package serializer
2 |
3 | import "singo/model"
4 |
5 | // User 用户序列化器
6 | type User struct {
7 | ID uint `json:"id"`
8 | UserName string `json:"user_name"`
9 | Nickname string `json:"nickname"`
10 | Status string `json:"status"`
11 | Avatar string `json:"avatar"`
12 | CreatedAt int64 `json:"created_at"`
13 | }
14 |
15 | // BuildUser 序列化用户
16 | func BuildUser(user model.User) User {
17 | return User{
18 | ID: user.ID,
19 | UserName: user.UserName,
20 | Nickname: user.Nickname,
21 | Status: user.Status,
22 | Avatar: user.Avatar,
23 | CreatedAt: user.CreatedAt.Unix(),
24 | }
25 | }
26 |
27 | // BuildUserResponse 序列化用户响应
28 | func BuildUserResponse(user model.User) Response {
29 | return Response{
30 | Data: BuildUser(user),
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/service/RegisterCellphoneService.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "crypto/md5"
5 | "encoding/hex"
6 | "github.com/gin-gonic/gin"
7 | "net/http"
8 | "singo/util"
9 | )
10 |
11 | type RegisterCellphoneService struct {
12 | Phone string `json:"phone" form:"phone"`
13 | Captcha string `json:"captcha" form:"captcha"`
14 | Password string `json:"password" form:"password"`
15 | Nickname string `json:"nickname" form:"nickname"`
16 | }
17 |
18 | func (service *RegisterCellphoneService) RegisterCellphone(c *gin.Context) map[string]interface{} {
19 |
20 | // 获得所有cookie
21 | cookies := c.Request.Cookies()
22 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
23 | cookies = append(cookies, cookiesOS)
24 |
25 | options := &util.Options{
26 | Crypto: "weapi",
27 | Cookies: cookies,
28 | }
29 | data := make(map[string]string)
30 |
31 | data["phone"] = service.Phone
32 | h := md5.New()
33 | h.Write([]byte(service.Password))
34 | data["password"] = hex.EncodeToString(h.Sum(nil))
35 | data["captcha"] = service.Captcha
36 | data["nickname"] = service.Nickname
37 |
38 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/register/cellphone`, data, options)
39 |
40 | return reBody
41 | }
42 |
--------------------------------------------------------------------------------
/service/activate_init_profile_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ActivateInitProfileService struct {
9 | Nickname string `json:"nickname" form:"nickname"`
10 | }
11 |
12 | func (service *ActivateInitProfileService) ActivateInitProfile(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "eapi",
19 | Cookies: cookies,
20 | Url: "/api/activate/initProfile",
21 | }
22 | data := make(map[string]string)
23 | data["nickname"] = service.Nickname
24 |
25 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/eapi/activate/initProfile`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/album_detail_dynamic_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumDetailDynamicService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *AlbumDetailDynamicService) AlbumDetailDynamic(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/album/detail/dynamic`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/album_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumDetailService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *AlbumDetailService) AlbumDetail(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/vipmall/albumproduct/detail`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/album_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumListService struct {
9 | Area string `json:"area" form:"area"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | Type string `json:"type" form:"type"`
13 | }
14 |
15 | func (service *AlbumListService) AlbumList(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | if service.Area == "" {
36 | data["area"] = "ALL"
37 | } else {
38 | data["area"] = service.Offset
39 | }
40 | data["order"] = "true"
41 | data["type"] = service.Type
42 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/vipmall/albumproduct/list`, data, options)
43 |
44 | return reBody
45 | }
46 |
--------------------------------------------------------------------------------
/service/album_list_style_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumListStyleService struct {
9 | Area string `json:"area" form:"area"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *AlbumListStyleService) AlbumListStyle(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | if service.Limit == "" {
25 | data["limit"] = "10"
26 | } else {
27 | data["limit"] = service.Limit
28 | }
29 | if service.Offset == "" {
30 | data["offset"] = "0"
31 | } else {
32 | data["offset"] = service.Offset
33 | }
34 | if service.Area == "" {
35 | service.Area = "Z_H"
36 | }
37 | data["order"] = "true"
38 | data["area"] = service.Area
39 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/vipmall/appalbum/album/style`, data, options)
40 |
41 | return reBody
42 | }
43 |
--------------------------------------------------------------------------------
/service/album_new_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type AlbumNewService struct {
10 | Area string `json:"area" form:"area"` //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | }
14 |
15 | func (service *AlbumNewService) AlbumNew(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 |
28 | if service.Area == "" {
29 | service.Area = "ALL"
30 | }
31 | if service.Limit == "" {
32 | service.Limit = "30"
33 | }
34 | if service.Offset == "" {
35 | service.Offset = "0"
36 | }
37 | data["area"] = service.Area
38 | data["limit"] = service.Limit
39 | data["offset"] = service.Offset
40 | data["total"] = "true"
41 |
42 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/album/new`, data, options)
43 |
44 | return reBody
45 | }
46 |
--------------------------------------------------------------------------------
/service/album_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *AlbumService) Album(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/album/`+service.ID, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/album_songsaleboard_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumSongsaleboardService struct {
9 | AlbumType string `json:"albumType" form:"albumType"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | Type string `json:"type" form:"type"`
13 | Year string `json:"year" form:"year"`
14 | }
15 |
16 | func (service *AlbumSongsaleboardService) AlbumSongsaleboard(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 |
21 | options := &util.Options{
22 | Crypto: "weapi",
23 | Cookies: cookies,
24 | }
25 | data := make(map[string]string)
26 | if service.Limit == "" {
27 | data["limit"] = "30"
28 | } else {
29 | data["limit"] = service.Limit
30 | }
31 | if service.Offset == "" {
32 | data["offset"] = "0"
33 | } else {
34 | data["offset"] = service.Offset
35 | }
36 | if service.AlbumType == "" {
37 | service.AlbumType = "0"
38 | }
39 | if service.Type == "" {
40 | service.Type = "daily"
41 | }
42 | data["albumType"] = service.AlbumType
43 | if service.Type == "year" {
44 | data["year"] = service.Year
45 | }
46 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/feealbum/songsaleboard/`+service.Type+"/type", data, options)
47 |
48 | return reBody
49 | }
50 |
--------------------------------------------------------------------------------
/service/album_sub_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumSubService struct {
9 | ID string `json:"id" form:"id"`
10 | T string `json:"t" form:"t"`
11 | }
12 |
13 | func (service *AlbumSubService) AlbumSub(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.T == "1" {
24 | service.T = "sub"
25 | } else {
26 | service.T = "unsub"
27 | }
28 | data["id"] = service.ID
29 |
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/album/`+service.T, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/album_sublist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type AlbumSublistService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *AlbumSublistService) AlbumSublist(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "25"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["total"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/album/sublist`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/artist_album_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type ArtistAlbumService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | }
14 |
15 | func (service *ArtistAlbumService) ArtistAlbum(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | if service.Limit == "" {
28 | data["limit"] = "30"
29 | } else {
30 | data["limit"] = service.Limit
31 | }
32 | if service.Offset == "" {
33 | data["offset"] = "0"
34 | } else {
35 | data["offset"] = service.Offset
36 | }
37 | data["total"] = "true"
38 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/artist/albums/`+service.ID, data, options)
39 |
40 | return reBody
41 | }
42 |
--------------------------------------------------------------------------------
/service/artist_desc_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ArtistDescService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *ArtistDescService) ArtistDesc(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/artist/introduction`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/artist_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "fmt"
5 | "github.com/gin-gonic/gin"
6 | "singo/util"
7 | "strings"
8 | )
9 |
10 | /*
11 | type 取值
12 | 1:男歌手
13 | 2:女歌手
14 | 3:乐队
15 |
16 | area 取值
17 | -1:全部
18 | 7华语
19 | 96欧美
20 | 8:日本
21 | 16韩国
22 | 0:其他
23 |
24 | initial 取值 a-z/A-Z
25 | */
26 |
27 | type ArtistListService struct {
28 | Type string `json:"type" form:"type"`
29 | Limit string `json:"limit" form:"limit"`
30 | Offset string `json:"offset" form:"offset"`
31 | Area string `json:"area" form:"area"`
32 | Initial string `json:"initial" form:"initial"`
33 | }
34 |
35 | func (service *ArtistListService) ArtistList(c *gin.Context) map[string]interface{} {
36 |
37 | // 获得所有cookie
38 | cookies := c.Request.Cookies()
39 |
40 | options := &util.Options{
41 | Crypto: "weapi",
42 | Cookies: cookies,
43 | }
44 | data := make(map[string]string)
45 | if service.Limit == "" {
46 | data["limit"] = "30"
47 | } else {
48 | data["limit"] = service.Limit
49 | }
50 | if service.Offset == "" {
51 | data["offset"] = "0"
52 | } else {
53 | data["offset"] = service.Offset
54 | }
55 | if service.Type == "" {
56 | data["type"] = "1"
57 | } else {
58 | data["type"] = service.Type
59 | }
60 | data["total"] = "true"
61 | data["area"] = service.Area
62 | if service.Initial == "" {
63 | data["initial"] = ""
64 | } else {
65 | data["initial"] = fmt.Sprintf("%v", strings.ToUpper(service.Initial)[0])
66 | }
67 |
68 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v1/artist/list`, data, options)
69 |
70 | return reBody
71 | }
72 |
--------------------------------------------------------------------------------
/service/artist_mv_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ArtistMvService struct {
9 | ID string `json:"id" form:"id"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *ArtistMvService) ArtistMv(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["artistId"] = service.ID
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | data["total"] = "true"
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/artist/mvs`, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/artist_songs_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type ArtistSongsService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Order string `json:"order" form:"order"`
14 | }
15 |
16 | func (service *ArtistSongsService) ArtistSongs(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["id"] = service.ID
29 | if service.Limit == "" {
30 | data["limit"] = "100"
31 | } else {
32 | data["limit"] = service.Limit
33 | }
34 | if service.Offset == "" {
35 | data["offset"] = "0"
36 | } else {
37 | data["offset"] = service.Offset
38 | }
39 | if service.Order == "" {
40 | data["order"] = "hot"
41 | } else {
42 | data["order"] = service.Order
43 | }
44 | data["work_type"] = "1"
45 | data["private_cloud"] = "true"
46 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v1/artist/songs`, data, options)
47 |
48 | return reBody
49 | }
50 |
--------------------------------------------------------------------------------
/service/artist_sub_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ArtistSubService struct {
9 | T string `json:"t" form:"t"`
10 | Id string `json:"id" form:"id"`
11 | }
12 |
13 | func (service *ArtistSubService) ArtistSub(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.T == "1" {
25 | service.T = "sub"
26 | } else {
27 | service.T = "unsub"
28 | }
29 |
30 | data["artistId"] = service.Id
31 | data["artistIds"] = "[" + service.Id + "]"
32 |
33 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/artist/`+service.T, data, options)
34 |
35 | return reBody
36 | }
37 |
--------------------------------------------------------------------------------
/service/artist_sublist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ArtistSublistService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *ArtistSublistService) ArtistSublist(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.Limit == "" {
25 | service.Limit = "25"
26 | }
27 | if service.Offset == "" {
28 | service.Offset = "0"
29 | }
30 | data["limit"] = service.Limit
31 | data["offset"] = service.Offset
32 | data["total"] = "true"
33 |
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/artist/sublist`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/artist_top_song_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ArtistTopSongService struct {
9 | Id string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *ArtistTopSongService) ArtistTopSong(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 |
23 | data["id"] = service.Id
24 |
25 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/artist/top/song`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/artists_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ArtistsService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *ArtistsService) Artists(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 |
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/artist/`+service.ID, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/banner_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type BannerService struct {
9 | Type string `json:"type" form:"type"`
10 | }
11 |
12 | func (service *BannerService) Banner(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "linuxapi",
19 | Cookies: cookies,
20 | }
21 |
22 | TYPE := make(map[string]string, 6)
23 | TYPE["0"] = "pc"
24 | TYPE["1"] = "android"
25 | TYPE["2"] = "iphone"
26 | TYPE["3"] = "ipad"
27 |
28 | data := make(map[string]string)
29 | if _, ok := TYPE[service.Type]; ok {
30 | service.Type = TYPE[service.Type]
31 | } else {
32 | service.Type = TYPE["0"]
33 | }
34 | data["clientType"] = service.Type
35 |
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v2/banner/get`, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/batch_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | )
6 |
7 | type BatchService struct {
8 | }
9 |
10 | func (service *BatchService) Batch(c *gin.Context) map[string]interface{} {
11 |
12 | reBody := make(map[string]interface{})
13 | reBody["code"] = "500"
14 | reBody["err"] = "该接口未实现,欢迎pr"
15 | return reBody
16 | }
17 |
--------------------------------------------------------------------------------
/service/captcha_sent_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CaptchaSentService struct {
10 | Ctcode string `json:"ctcode" form:"ctcode"`
11 | Cellphone string `json:"phone" form:"phone"`
12 | }
13 |
14 | func (service *CaptchaSentService) CaptchaSent(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
19 | cookies = append(cookies, cookiesOS)
20 |
21 | options := &util.Options{
22 | Crypto: "weapi",
23 | Cookies: cookies,
24 | }
25 | data := make(map[string]string)
26 | if service.Ctcode == "" {
27 | data["ctcode"] = "86"
28 | } else {
29 | data["ctcode"] = service.Ctcode
30 | }
31 | data["cellphone"] = service.Cellphone
32 |
33 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/sms/captcha/sent`, data, options)
34 |
35 | return reBody
36 | }
37 |
--------------------------------------------------------------------------------
/service/captcha_verify_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CaptchaVerifyService struct {
10 | Ctcode string `json:"ctcode" form:"ctcode"`
11 | Cellphone string `json:"phone" form:"phone"`
12 | Captcha string `json:"captcha" form:"captcha"`
13 | }
14 |
15 | func (service *CaptchaVerifyService) CaptchaVerify(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | if service.Ctcode == "" {
28 | data["ctcode"] = "86"
29 | } else {
30 | data["ctcode"] = service.Ctcode
31 | }
32 | data["cellphone"] = service.Cellphone
33 | data["captcha"] = service.Captcha
34 |
35 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/sms/captcha/verify`, data, options)
36 |
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/cellphone_existence_check_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type CellphoneExistenceCheckService struct {
9 | Cellphone string `json:"phone" form:"phone"`
10 | Countrycode string `json:"countrycode" form:"countrycode"`
11 | }
12 |
13 | func (service *CellphoneExistenceCheckService) CellphoneExistenceCheck(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "eapi",
20 | Cookies: cookies,
21 | Url: "/api/cellphone/existence/check",
22 | }
23 | data := make(map[string]string)
24 | if service.Countrycode != "" {
25 | data["countrycode"] = service.Countrycode
26 | }
27 | data["cellphone"] = service.Cellphone
28 |
29 | reBody, cookies := util.CreateRequest("POST", `http://music.163.com/eapi/cellphone/existence/check`, data, options)
30 |
31 | return reBody
32 | }
33 |
--------------------------------------------------------------------------------
/service/check_music_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type CheckMusicService struct {
9 | ID string `json:"id" form:"id"`
10 | Br string `json:"br" form:"br"`
11 | }
12 |
13 | func (service *CheckMusicService) CheckMusic(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["ids"] = "[" + service.ID + "]"
24 | if service.Br == "" {
25 | service.Br = "999000"
26 | }
27 | data["br"] = service.Br
28 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/song/enhance/player/url`, data, options)
29 |
30 | if reBody["code"].(float64) == 200 {
31 | reBody["success"] = true
32 | reBody["message"] = "ok"
33 | } else {
34 | reBody["success"] = false
35 | reBody["message"] = "亲爱的,暂无版权"
36 | }
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/comment_album_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentAlbumService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Before string `json:"before" form:"before"`
14 | }
15 |
16 | func (service *CommentAlbumService) CommentAlbum(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["rid"] = service.ID
29 | if service.Limit == "" {
30 | data["limit"] = "20"
31 | } else {
32 | data["limit"] = service.Limit
33 | }
34 | if service.Offset == "" {
35 | data["offset"] = "0"
36 | } else {
37 | data["offset"] = service.Offset
38 | }
39 | if service.Before == "" {
40 | data["beforeTime"] = "0"
41 | } else {
42 | data["beforeTime"] = service.Before
43 | }
44 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/resource/comments/R_AL_3_`+service.ID, data, options)
45 |
46 | return reBody
47 | }
48 |
--------------------------------------------------------------------------------
/service/comment_dj_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentDjService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Before string `json:"before" form:"before"`
14 | }
15 |
16 | func (service *CommentDjService) CommentDj(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["rid"] = service.ID
29 | if service.Limit == "" {
30 | data["limit"] = "20"
31 | } else {
32 | data["limit"] = service.Limit
33 | }
34 | if service.Offset == "" {
35 | data["offset"] = "0"
36 | } else {
37 | data["offset"] = service.Offset
38 | }
39 | if service.Before == "" {
40 | data["beforeTime"] = "0"
41 | } else {
42 | data["beforeTime"] = service.Before
43 | }
44 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/resource/comments/A_DJ_1_`+service.ID, data, options)
45 |
46 | return reBody
47 | }
48 |
--------------------------------------------------------------------------------
/service/comment_event_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type CommentEventService struct {
9 | ThreadId string `json:"threadId" form:"threadId"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | BeforeTime string `json:"beforeTime" form:"beforeTime"`
13 | }
14 |
15 | func (service *CommentEventService) CommentEvent(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | if service.Limit == "" {
26 | data["limit"] = "20"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | if service.BeforeTime == "" {
36 | data["beforeTime"] = "0"
37 | } else {
38 | data["beforeTime"] = service.BeforeTime
39 | }
40 |
41 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/resource/comments/`+service.ThreadId, data, options)
42 |
43 | return reBody
44 | }
45 |
--------------------------------------------------------------------------------
/service/comment_floor_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type CommentFloorService struct {
9 | ParentCommentId string `json:"parentCommentId" form:"parentCommentId"`
10 | Limit string `json:"type" form:"limit"`
11 | Type string `json:"type" form:"type"`
12 | Id string `json:"id" form:"id"`
13 | Time string `json:"time" form:"time"`
14 | }
15 |
16 | func (service *CommentFloorService) CommentFloor(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 |
21 | options := &util.Options{
22 | Crypto: "weapi",
23 | Cookies: cookies,
24 | }
25 | data := make(map[string]string)
26 | Type := map[string]string{
27 | "0": "R_SO_4_", // 歌曲
28 | "1": "R_MV_5_", // MV
29 | "2": "A_PL_0_", // 歌单
30 | "3": "R_AL_3_", // 专辑
31 | "4": "A_DJ_1_", // 电台,
32 | "5": "R_VI_62_", // 视频
33 | }
34 | if service.Limit == "" {
35 | data["limit"] = "20"
36 | } else {
37 | data["limit"] = service.Limit
38 | }
39 | if service.Time == "" {
40 | data["time"] = "0"
41 | } else {
42 | data["time"] = service.Time
43 | }
44 | data["parentCommentId"] = service.ParentCommentId
45 | data["threadId"] = Type[service.Type] + service.Id
46 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/resource/comment/floor/get`, data, options)
47 |
48 | return reBody
49 | }
50 |
--------------------------------------------------------------------------------
/service/comment_hot_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentHotService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Before string `json:"before" form:"before"`
14 | Type string `json:"type" form:"type"`
15 | }
16 |
17 | func (service *CommentHotService) CommentHot(c *gin.Context) map[string]interface{} {
18 |
19 | // 获得所有cookie
20 | cookies := c.Request.Cookies()
21 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
22 | cookies = append(cookies, cookiesOS)
23 |
24 | options := &util.Options{
25 | Crypto: "weapi",
26 | Cookies: cookies,
27 | }
28 | TYPE := make(map[string]string, 6)
29 | TYPE["0"] = "R_SO_4_"
30 | TYPE["1"] = "R_MV_5_"
31 | TYPE["2"] = "A_PL_0_"
32 | TYPE["3"] = "R_AL_3_"
33 | TYPE["4"] = "A_DJ_1_"
34 | TYPE["5"] = "R_VI_62_"
35 | data := make(map[string]string)
36 |
37 | data["rid"] = service.ID
38 | if _, ok := TYPE[service.Type]; ok {
39 | service.Type = TYPE[service.Type]
40 | } else {
41 | service.Type = TYPE["0"]
42 | }
43 | if service.Limit == "" {
44 | data["limit"] = "20"
45 | } else {
46 | data["limit"] = service.Limit
47 | }
48 | if service.Offset == "" {
49 | data["offset"] = "0"
50 | } else {
51 | data["offset"] = service.Offset
52 | }
53 | if service.Before == "" {
54 | data["beforeTime"] = "0"
55 | } else {
56 | data["beforeTime"] = service.Before
57 | }
58 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/resource/hotcomments/`+service.Type+service.ID, data, options)
59 |
60 | return reBody
61 | }
62 |
--------------------------------------------------------------------------------
/service/comment_hotwall_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type CommentHotwallListService struct {
9 | }
10 |
11 | func (service *CommentHotwallListService) CommentHotwallList(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 |
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/comment/hotwall/list/get`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/comment_like_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentLikeService struct {
10 | ID string `json:"id" form:"id"`
11 | ThreadId string `json:"threadId" form:"threadId"`
12 | Cid string `json:"cid" form:"cid"`
13 | T string `json:"t" form:"t"`
14 | Type string `json:"type" form:"type"`
15 | }
16 |
17 | func (service *CommentLikeService) CommentLike(c *gin.Context) map[string]interface{} {
18 |
19 | // 获得所有cookie
20 | cookies := c.Request.Cookies()
21 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
22 | cookies = append(cookies, cookiesOS)
23 |
24 | options := &util.Options{
25 | Crypto: "weapi",
26 | Cookies: cookies,
27 | }
28 |
29 | TYPE := make(map[string]string, 6)
30 | TYPE["0"] = "R_SO_4_"
31 | TYPE["1"] = "R_MV_5_"
32 | TYPE["2"] = "A_PL_0_"
33 | TYPE["3"] = "R_AL_3_"
34 | TYPE["4"] = "A_DJ_1_"
35 | TYPE["5"] = "R_VI_62_"
36 | TYPE["6"] = "A_EV_2_"
37 |
38 | if _, ok := TYPE[service.Type]; ok {
39 | service.Type = TYPE[service.Type]
40 | } else {
41 | service.Type = TYPE["0"]
42 | }
43 |
44 | data := make(map[string]string)
45 | data["commentId"] = service.Cid
46 | data["threadId"] = service.Type + service.ID
47 |
48 | if service.Type == "A_EV_2_" {
49 | data["threadId"] = service.ThreadId
50 | }
51 |
52 | if service.T == "1" {
53 | service.T = "like"
54 | } else {
55 | service.T = "unlike"
56 | }
57 |
58 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/comment/`+service.T, data, options)
59 |
60 | return reBody
61 | }
62 |
--------------------------------------------------------------------------------
/service/comment_music_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentMusicService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Before string `json:"before" form:"before"`
14 | }
15 |
16 | func (service *CommentMusicService) CommentMusic(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["rid"] = service.ID
29 | if service.Limit == "" {
30 | data["limit"] = "20"
31 | } else {
32 | data["limit"] = service.Limit
33 | }
34 | if service.Offset == "" {
35 | data["offset"] = "0"
36 | } else {
37 | data["offset"] = service.Offset
38 | }
39 | if service.Before == "" {
40 | data["beforeTime"] = "0"
41 | } else {
42 | data["beforeTime"] = service.Before
43 | }
44 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v1/resource/comments/R_SO_4_`+service.ID, data, options)
45 |
46 | return reBody
47 | }
48 |
--------------------------------------------------------------------------------
/service/comment_mv_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentMvService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Before string `json:"before" form:"before"`
14 | }
15 |
16 | func (service *CommentMvService) CommentMv(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["rid"] = service.ID
29 | if service.Limit == "" {
30 | data["limit"] = "20"
31 | } else {
32 | data["limit"] = service.Limit
33 | }
34 | if service.Offset == "" {
35 | data["offset"] = "0"
36 | } else {
37 | data["offset"] = service.Offset
38 | }
39 | if service.Before == "" {
40 | data["beforeTime"] = "0"
41 | } else {
42 | data["beforeTime"] = service.Before
43 | }
44 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/resource/comments/R_MV_5_`+service.ID, data, options)
45 |
46 | return reBody
47 | }
48 |
--------------------------------------------------------------------------------
/service/comment_playlist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentPlaylistService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Before string `json:"before" form:"before"`
14 | }
15 |
16 | func (service *CommentPlaylistService) CommentPlaylist(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["rid"] = service.ID
29 | if service.Limit == "" {
30 | data["limit"] = "20"
31 | } else {
32 | data["limit"] = service.Limit
33 | }
34 | if service.Offset == "" {
35 | data["offset"] = "0"
36 | } else {
37 | data["offset"] = service.Offset
38 | }
39 | if service.Before == "" {
40 | data["beforeTime"] = "0"
41 | } else {
42 | data["beforeTime"] = service.Before
43 | }
44 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/resource/comments/A_PL_0_`+service.ID, data, options)
45 |
46 | return reBody
47 | }
48 |
--------------------------------------------------------------------------------
/service/comment_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentService struct {
10 | ID string `json:"id" form:"id"`
11 | ThreadId string `json:"threadId" form:"threadId"`
12 | Content string `json:"content" form:"content"`
13 | T string `json:"t" form:"t"`
14 | Type string `json:"type" form:"type"`
15 | CommentId string `json:"commentId" form:"commentId"`
16 | }
17 |
18 | func (service *CommentService) Comment(c *gin.Context) map[string]interface{} {
19 |
20 | // 获得所有cookie
21 | cookies := c.Request.Cookies()
22 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
23 | cookies = append(cookies, cookiesOS)
24 |
25 | options := &util.Options{
26 | Crypto: "weapi",
27 | Cookies: cookies,
28 | }
29 | TYPE := make(map[string]string, 6)
30 | TYPE["0"] = "R_SO_4_"
31 | TYPE["1"] = "R_MV_5_"
32 | TYPE["2"] = "A_PL_0_"
33 | TYPE["3"] = "R_AL_3_"
34 | TYPE["4"] = "A_DJ_1_"
35 | TYPE["5"] = "R_VI_62_"
36 | TYPE["6"] = "A_EV_2_"
37 |
38 | T := make(map[string]string, 3)
39 | T["0"] = "delete"
40 | T["1"] = "add"
41 | T["2"] = "reply"
42 |
43 | if _, ok := TYPE[service.Type]; ok {
44 | service.Type = TYPE[service.Type]
45 | } else {
46 | service.Type = TYPE["0"]
47 | }
48 |
49 | if _, ok := T[service.T]; ok {
50 | service.T = T[service.T]
51 | } else {
52 | service.T = T["1"]
53 | }
54 |
55 | data := make(map[string]string)
56 | data["threadId"] = service.Type + service.ID
57 |
58 | if service.Type == "A_EV_2_" {
59 | data["threadId"] = service.ThreadId
60 | }
61 |
62 | if service.T == "add" {
63 | data["content"] = service.Content
64 | } else if service.T == "delete" {
65 | data["commentId"] = service.CommentId
66 | } else if service.T == "reply" {
67 | data["commentId"] = service.CommentId
68 | data["content"] = service.Content
69 | }
70 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/resource/comments/`+service.T, data, options)
71 |
72 | return reBody
73 | }
74 |
--------------------------------------------------------------------------------
/service/comment_video_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type CommentVideoService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | Before string `json:"before" form:"before"`
14 | }
15 |
16 | func (service *CommentVideoService) CommentVideo(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["rid"] = service.ID
29 | if service.Limit == "" {
30 | data["limit"] = "20"
31 | } else {
32 | data["limit"] = service.Limit
33 | }
34 | if service.Offset == "" {
35 | data["offset"] = "0"
36 | } else {
37 | data["offset"] = service.Offset
38 | }
39 | if service.Before == "" {
40 | data["beforeTime"] = "0"
41 | } else {
42 | data["beforeTime"] = service.Before
43 | }
44 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/resource/comments/R_VI_62_`+service.ID, data, options)
45 |
46 | return reBody
47 | }
48 |
--------------------------------------------------------------------------------
/service/countries_code_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type CountriesCodeListService struct {
9 | }
10 |
11 | func (service *CountriesCodeListService) CountriesCodeList(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "eapi",
18 | Cookies: cookies,
19 | Url: "/api/lbs/countries/v1",
20 | }
21 | data := make(map[string]string)
22 | reBody, _ := util.CreateRequest("POST", `http://interface3.music.163.com/eapi/lbs/countries/v1`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/daily_signin_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DailySigninService struct {
9 | Type string `json:"type" form:"type"`
10 | }
11 |
12 | func (service *DailySigninService) DailySignin(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 |
23 | if service.Type == "" {
24 | data["type"] = "0"
25 | } else {
26 | data["type"] = service.Type
27 | }
28 |
29 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/point/dailyTask`, data, options)
30 |
31 | return reBody
32 | }
33 |
--------------------------------------------------------------------------------
/service/digitalAlbum_ordering_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/gin-gonic/gin"
6 | "singo/util"
7 | )
8 |
9 | type DigitalAlbumOrderingService struct {
10 | ID string `json:"id" form:"id"`
11 | PaymentMethod string `json:"payment" form:"payment"`
12 | Quantity string `json:"quantity" form:"quantity"`
13 | }
14 |
15 | func (service *DigitalAlbumOrderingService) DigitalAlbumOrdering(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | data["business"] = "Album"
26 | data["paymentMethod"] = service.PaymentMethod
27 | data["from"] = "web"
28 |
29 | var digitalResources []map[string]string
30 | dMap := make(map[string]string)
31 | dMap["business"] = "Album"
32 | dMap["resourceID"] = service.ID
33 | dMap["quantity"] = service.Quantity
34 | digitalResources = append(digitalResources, dMap)
35 | dig, _ := json.Marshal(digitalResources)
36 |
37 | data["digitalResources"] = string(dig)
38 |
39 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/ordering/web/digital`, data, options)
40 |
41 | return reBody
42 | }
43 |
--------------------------------------------------------------------------------
/service/digital_album_purchased_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DigitalAlbumPurchasedService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *DigitalAlbumPurchasedService) DigitalAlbumPurchased(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "30"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/digitalAlbum/purchased`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/dj_banner_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type DjBannerService struct {
10 | }
11 |
12 | func (service *DjBannerService) DjBanner(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
17 | cookies = append(cookies, cookiesOS)
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/djradio/banner/get`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/dj_category_excludehot_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjCategoryExcludehotService struct {
9 | }
10 |
11 | func (service *DjCategoryExcludehotService) DjCategoryExcludehot(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/djradio/category/excludehot`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/dj_category_recommend_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjCategoryRecommendService struct {
9 | }
10 |
11 | func (service *DjCategoryRecommendService) DjCategoryRecommend(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/djradio/home/category/recommend`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/dj_catelist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjCatelistService struct {
9 | }
10 |
11 | func (service *DjCatelistService) DjCatelist(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/category/get`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/dj_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjDetailService struct {
9 | ID string `json:"rid" form:"rid"`
10 | }
11 |
12 | func (service *DjDetailService) DjDetail(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/get`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/dj_hot_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjHotService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *DjHotService) DjHot(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.Limit == "" {
25 | data["limit"] = "30"
26 | } else {
27 | data["limit"] = service.Limit
28 | }
29 | if service.Offset == "" {
30 | data["offset"] = "0"
31 | } else {
32 |
33 | data["offset"] = service.Offset
34 | }
35 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/hot/v1`, data, options)
36 |
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/dj_paygift_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjPaygiftService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *DjPaygiftService) DjPaygift(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "30"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/home/paygift/list?_nmclfl=1`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/dj_program_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjProgramDetailService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *DjProgramDetailService) DjProgramDetail(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/dj/program/detail`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/dj_program_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjProgramService struct {
9 | RID string `json:"rid" form:"rid"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | Asc string `json:"asc" form:"asc"`
13 | }
14 |
15 | func (service *DjProgramService) DjProgram(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | data["radioId"] = service.RID
26 | if service.Limit == "" {
27 | data["limit"] = "30"
28 | } else {
29 | data["limit"] = service.Limit
30 | }
31 | if service.Offset == "" {
32 | data["offset"] = "0"
33 | } else {
34 | data["offset"] = service.Offset
35 | }
36 | data["asc"] = service.Asc
37 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/dj/program/byradio`, data, options)
38 |
39 | return reBody
40 | }
41 |
--------------------------------------------------------------------------------
/service/dj_program_toplist_hours_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjProgramToplistHoursService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | }
11 |
12 | func (service *DjProgramToplistHoursService) DjProgramToplistHours(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | if service.Limit == "" {
23 | data["limit"] = "30"
24 | } else {
25 | data["limit"] = service.Limit
26 | }
27 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/djprogram/toplist/hours`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/dj_program_toplist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjProgramToplistService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *DjProgramToplistService) DjProgramToplist(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "100"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/program/toplist/v1`, data, options)
34 |
35 | return reBody
36 | }
37 |
--------------------------------------------------------------------------------
/service/dj_radio_hot_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjRadioHotService struct {
9 | CateId string `json:"cateId" form:"cateId"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *DjRadioHotService) DjRadioHot(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["cateId"] = service.CateId
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/djradio/hot`, data, options)
36 |
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/dj_recommend_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjRecommendService struct {
9 | }
10 |
11 | func (service *DjRecommendService) DjRecommend(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 |
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/recommend/v1`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/dj_recommend_type_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | /*
9 | 有声书 10001
10 | 知识技能 453050
11 | 商业财经 453051
12 | 人文历史 11
13 | 外语世界 13
14 | 亲子宝贝 14
15 | 创作|翻唱 2001
16 | 音乐故事 2
17 | 3D|电子 10002
18 | 相声曲艺 8
19 | 情感调频 3
20 | 美文读物 6
21 | 脱口秀 5
22 | 广播剧 7
23 | 二次元 3001
24 | 明星做主播 1
25 | 娱乐|影视 4
26 | 科技科学 453052
27 | 校园|教育 4001
28 | 旅途|城市 12
29 | */
30 |
31 | type DjRecommendTypeService struct {
32 | CateId string `json:"type" form:"type"`
33 | }
34 |
35 | func (service *DjRecommendTypeService) DjRecommendType(c *gin.Context) map[string]interface{} {
36 |
37 | // 获得所有cookie
38 | cookies := c.Request.Cookies()
39 |
40 | options := &util.Options{
41 | Crypto: "weapi",
42 | Cookies: cookies,
43 | }
44 | data := make(map[string]string)
45 | data["cateId"] = service.CateId
46 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/recommend`, data, options)
47 |
48 | return reBody
49 | }
50 |
--------------------------------------------------------------------------------
/service/dj_sub_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjSubService struct {
9 | RID string `json:"rid" form:"rid"`
10 | T string `json:"t" form:"t"`
11 | }
12 |
13 | func (service *DjSubService) DjSub(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["id"] = service.RID
24 | if service.T == "1" {
25 | service.T = "sub"
26 | } else {
27 | service.T = "unsub"
28 | }
29 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/`+service.T, data, options)
30 |
31 | return reBody
32 | }
33 |
--------------------------------------------------------------------------------
/service/dj_sublist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjSublistService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *DjSublistService) DjSublist(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "30"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/get/subed`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/dj_today_perfered_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjTodayPerferedService struct {
9 | Page string `json:"page" form:"page"`
10 | }
11 |
12 | func (service *DjTodayPerferedService) DjTodayPerfered(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | if service.Page == "" {
23 | data["page"] = "0"
24 | } else {
25 | data["page"] = service.Page
26 | }
27 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/djradio/home/today/perfered`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/dj_toplist_newcomer_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjToplistNewcomerService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *DjToplistNewcomerService) DjToplistNewcomer(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "100"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 |
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/dj/toplist/newcomer`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/dj_toplist_pay_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjToplistPayService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | }
11 |
12 | func (service *DjToplistPayService) DjToplistPay(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 |
23 | if service.Limit == "" {
24 | data["limit"] = "10"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 |
29 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/djradio/toplist/pay`, data, options)
30 |
31 | return reBody
32 | }
33 |
--------------------------------------------------------------------------------
/service/dj_toplist_popular_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjToplistPopularService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | }
11 |
12 | func (service *DjToplistPopularService) DjToplistPopular(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | if service.Limit == "" {
23 | data["limit"] = "100"
24 | } else {
25 | data["limit"] = service.Limit
26 | }
27 |
28 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/dj/toplist/popular`, data, options)
29 |
30 | return reBody
31 | }
32 |
--------------------------------------------------------------------------------
/service/dj_toplist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjToplistService struct {
9 | Type string `json:"type" form:"type"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *DjToplistService) DjToplist(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | if service.Limit == "" {
25 | data["limit"] = "100"
26 | } else {
27 | data["limit"] = service.Limit
28 | }
29 | if service.Offset == "" {
30 | data["offset"] = "0"
31 | } else {
32 | data["offset"] = service.Offset
33 | }
34 | if service.Type == "hot" {
35 | data["type"] = "1"
36 | } else {
37 | data["type"] = "0"
38 | }
39 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/djradio/toplist`, data, options)
40 |
41 | return reBody
42 | }
43 |
--------------------------------------------------------------------------------
/service/dj_toplist_sours_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type DjToplistHoursService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | }
11 |
12 | func (service *DjToplistHoursService) DjToplistHours(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | if service.Limit == "" {
23 | data["limit"] = "100"
24 | } else {
25 | data["limit"] = service.Limit
26 | }
27 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/dj/toplist/hours`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/event_del_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type EventDelService struct {
10 | EvId string `json:"evId" form:"evId"`
11 | }
12 |
13 | func (service *EventDelService) EventDel(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | data["id"] = service.EvId
26 |
27 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/eapi/event/delete`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/event_forward_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type EventForwardService struct {
10 | Uid string `json:"uid" form:"uid"`
11 | EvId string `json:"evId" form:"evId"`
12 | Forwards string `json:"forwards" form:"forwards"`
13 | }
14 |
15 | func (service *EventForwardService) EventForward(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | data["id"] = service.EvId
28 | data["eventUserId"] = service.Uid
29 | data["forwards"] = service.Forwards
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/event/forward`, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/event_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type EventService struct {
9 | PageSize string `json:"pagesize" form:"pagesize"`
10 | LastTime string `json:"lasttime" form:"lasttime"`
11 | }
12 |
13 | func (service *EventService) Event(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.PageSize == "" {
24 | data["pagesize"] = "20"
25 | } else {
26 | data["pagesize"] = service.PageSize
27 | }
28 | if service.LastTime == "" {
29 | data["lasttime"] = "-1"
30 | } else {
31 | data["lasttime"] = service.LastTime
32 | }
33 |
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/event/get`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/fm_trash_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type FmTrashService struct {
9 | SongID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *FmTrashService) FmTrash(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["songId"] = service.SongID
23 |
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/radio/trash/add?alg=RT&songId=`+service.SongID+`&time=25`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/follow_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type FollowService struct {
10 | T string `json:"t" form:"t"`
11 | Id string `json:"id" form:"id"`
12 | }
13 |
14 | func (service *FollowService) Follow(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
19 | cookies = append(cookies, cookiesOS)
20 |
21 | options := &util.Options{
22 | Crypto: "weapi",
23 | Cookies: cookies,
24 | }
25 | data := make(map[string]string)
26 | if service.T == "1" {
27 | service.T = "follow"
28 | } else {
29 | service.T = "delfollow"
30 | }
31 |
32 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/user/`+service.T+`/`+service.Id, data, options)
33 |
34 | return reBody
35 | }
36 |
--------------------------------------------------------------------------------
/service/history_recommend_dongs_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type HistoryRecommendDongsDetailService struct {
10 | Date string `json:"date" form:"date"`
11 | }
12 |
13 | func (service *HistoryRecommendDongsDetailService) HistoryRecommendDongsDetail(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "ios"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | data["date"] = service.Date
26 |
27 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/discovery/recommend/songs/history/detail`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/history_recommend_songs_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type HistoryRecommendSongsService struct {
10 | }
11 |
12 | func (service *HistoryRecommendSongsService) HistoryRecommendSongs(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 | cookiesOS := &http.Cookie{Name: "os", Value: "ios"}
17 | cookies = append(cookies, cookiesOS)
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/discovery/recommend/songs/history/recent`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/homepage_block_page_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type HomepageBlockPageService struct {
10 | Refresh string `json:"refresh" form:"refresh"`
11 | }
12 |
13 | func (service *HomepageBlockPageService) HomepageBlockPage(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | if service.Refresh == "" {
26 | service.Refresh = "true"
27 | }
28 | data["refresh"] = service.Refresh
29 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/homepage/block/page`, data, options)
30 |
31 | return reBody
32 | }
33 |
--------------------------------------------------------------------------------
/service/homepage_dragon_ball_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type HomepageDragonBallService struct {
9 | }
10 |
11 | func (service *HomepageDragonBallService) HomepageDragonBall(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "eapi",
18 | Cookies: cookies,
19 | Url: "/api/homepage/dragon/ball/static",
20 | }
21 | data := make(map[string]string)
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/eapi/homepage/dragon/ball/static`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/hot_topic_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type HotTopicService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *HotTopicService) HotTopic(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "20"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/act/hot`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/like_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type LikeListService struct {
9 | UID string `json:"uid" form:"uid"`
10 | }
11 |
12 | func (service *LikeListService) LikeList(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 |
22 | data := make(map[string]string)
23 | data["uid"] = service.UID
24 |
25 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/song/like/get`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/like_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type LikeService struct {
9 | ID string `json:"id" form:"id"`
10 | L string `json:"like" form:"like"`
11 | }
12 |
13 | func (service *LikeService) Like(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["trackId"] = service.ID
24 | if service.L == "" {
25 | data["like"] = "true"
26 | } else {
27 | data["like"] = service.L
28 | }
29 |
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/radio/like?alg=itembased&trackId=`+service.ID+`&time=25`, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/login_cellphone_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "crypto/md5"
5 | "encoding/hex"
6 | "github.com/gin-gonic/gin"
7 | "net/http"
8 | "singo/util"
9 | )
10 |
11 | type LoginCellphoneService struct {
12 | Phone string `json:"phone" form:"phone"`
13 | Countrycode string `json:"countrycode" form:"countrycode"`
14 | Password string `json:"password" form:"password"`
15 | Md5password string `json:"md5_password" form:"md5_password"`
16 | }
17 |
18 | func (service *LoginCellphoneService) LoginCellphone(c *gin.Context) map[string]interface{} {
19 |
20 | // 获得所有cookie
21 | cookies := c.Request.Cookies()
22 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
23 | cookies = append(cookies, cookiesOS)
24 |
25 | options := &util.Options{
26 | Crypto: "weapi",
27 | Ua: "pc",
28 | Cookies: cookies,
29 | }
30 | data := make(map[string]string)
31 |
32 | data["phone"] = service.Phone
33 | if service.Countrycode != "" {
34 | data["countrycode"] = service.Countrycode
35 | }
36 | if service.Password != "" {
37 | h := md5.New()
38 | h.Write([]byte(service.Password))
39 | data["password"] = hex.EncodeToString(h.Sum(nil))
40 | } else {
41 | data["password"] = service.Md5password
42 | }
43 | data["rememberLogin"] = "true"
44 |
45 | //reBody, cookies := util.CreateRequest("POST", `https://www.httpbin.org/post`, data, options)
46 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/login/cellphone`, data, options)
47 |
48 | cookiesStr := ""
49 |
50 | for _, cookie := range cookies {
51 | if cookiesStr != "" {
52 | cookiesStr = cookiesStr + ";"
53 | }
54 | cookiesStr = cookiesStr + cookie.String()
55 | c.SetCookie(cookie.Name, cookie.Value, 60*60*24, "", cookie.Domain, false, false)
56 | }
57 |
58 | reBody["cookie"] = cookiesStr
59 |
60 | return reBody
61 | }
62 |
--------------------------------------------------------------------------------
/service/login_email_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "crypto/md5"
5 | "encoding/hex"
6 | "github.com/gin-gonic/gin"
7 | "net/http"
8 | "singo/util"
9 | )
10 |
11 | type LoginEmailService struct {
12 | Email string `json:"email" form:"email"`
13 | Password string `json:"password" form:"password"`
14 | Md5password string `json:"md5_password" form:"md5_password"`
15 | }
16 |
17 | func (service *LoginEmailService) LoginEmail(c *gin.Context) map[string]interface{} {
18 |
19 | // 获得所有cookie
20 | cookies := c.Request.Cookies()
21 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
22 | cookies = append(cookies, cookiesOS)
23 |
24 | options := &util.Options{
25 | Crypto: "weapi",
26 | Ua: "pc",
27 | Cookies: cookies,
28 | }
29 | data := make(map[string]string)
30 |
31 | data["username"] = service.Email
32 | if service.Password != "" {
33 | h := md5.New()
34 | h.Write([]byte(service.Password))
35 | data["password"] = hex.EncodeToString(h.Sum(nil))
36 | } else {
37 | data["password"] = service.Md5password
38 | }
39 | data["rememberLogin"] = "true"
40 |
41 | //reBody, cookies := util.CreateRequest("POST", `https://www.httpbin.org/post`, data, options)
42 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/login`, data, options)
43 |
44 | cookiesStr := ""
45 |
46 | for _, cookie := range cookies {
47 | if cookiesStr != "" {
48 | cookiesStr = cookiesStr + ";"
49 | }
50 | cookiesStr = cookiesStr + cookie.String()
51 | c.SetCookie(cookie.Name, cookie.Value, 60*60*24, "", cookie.Domain, false, false)
52 | }
53 |
54 | reBody["cookie"] = cookiesStr
55 |
56 | return reBody
57 | }
58 |
--------------------------------------------------------------------------------
/service/login_refresh_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type LoginRefreshService struct {
10 | }
11 |
12 | func (service *LoginRefreshService) LoginRefresh(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
17 | cookies = append(cookies, cookiesOS)
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Ua: "pc",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/login/token/refresh`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/logout_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type LogoutService struct {
9 | }
10 |
11 | func (service *LogoutService) Logout(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Ua: "pc",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/logout`, data, options)
23 |
24 | for _, cookie := range cookies {
25 | c.SetCookie(cookie.Name, cookie.Value, -1, "", cookie.Domain, false, false)
26 | }
27 |
28 | return reBody
29 | }
30 |
--------------------------------------------------------------------------------
/service/lyric_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type LyricService struct {
10 | ID string `json:"id" form:"id"`
11 | }
12 |
13 | func (service *LyricService) Lyric(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "linuxapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | data["id"] = service.ID
26 | data["lv"] = "-1"
27 | data["kv"] = "-1"
28 | data["tv"] = "-1"
29 |
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/song/lyric`, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/msg_comments_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MsgCommentsService struct {
9 | UID string `json:"uid" form:"uid"`
10 | Limit string `json:"limit" form:"limit"`
11 | BeforeTime string `json:"before" form:"before"`
12 | }
13 |
14 | func (service *MsgCommentsService) MsgComments(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["uid"] = service.UID
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.BeforeTime == "" {
31 | data["beforeTime"] = "-1"
32 | } else {
33 | data["beforeTime"] = service.BeforeTime
34 | }
35 | data["order"] = "true"
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v1/user/comments/`+service.UID, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/msg_forwards_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MsgForwardsService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *MsgForwardsService) MsgForwards(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "30"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/forwards/get`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/msg_notices_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MsgNoticesService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | LastTime string `json:"lasttime" form:"lasttime"`
11 | }
12 |
13 | func (service *MsgNoticesService) MsgNotices(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "30"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.LastTime == "" {
29 | data["time"] = "-1"
30 | } else {
31 | data["time"] = service.LastTime
32 | }
33 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/msg/notices`, data, options)
34 |
35 | return reBody
36 | }
37 |
--------------------------------------------------------------------------------
/service/msg_private_history_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type MsgPrivateHistoryService struct {
10 | UID string `json:"uid" form:"uid"`
11 | Limit string `json:"limit" form:"limit"`
12 | Time string `json:"before" form:"before"`
13 | }
14 |
15 | func (service *MsgPrivateHistoryService) MsgPrivateHistory(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | data["userId"] = service.UID
28 | if service.Limit == "" {
29 | data["limit"] = "30"
30 | } else {
31 | data["limit"] = service.Limit
32 | }
33 | if service.Time == "" {
34 | data["offset"] = "0"
35 | } else {
36 | data["offset"] = service.Time
37 | }
38 | data["order"] = "true"
39 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/msg/private/history`, data, options)
40 |
41 | return reBody
42 | }
43 |
--------------------------------------------------------------------------------
/service/msg_private_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MsgPrivateService struct {
9 | ID string `json:"id" form:"id"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *MsgPrivateService) MsgPrivate(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | if service.Limit == "" {
25 | data["limit"] = "30"
26 | } else {
27 | data["limit"] = service.Limit
28 | }
29 | if service.Offset == "" {
30 | data["offset"] = "0"
31 | } else {
32 | data["offset"] = service.Offset
33 | }
34 | data["order"] = "true"
35 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/msg/private/users`, data, options)
36 |
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/mv_all_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/gin-gonic/gin"
6 | "singo/util"
7 | )
8 |
9 | type MvAllService struct {
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | Area string `json:"area" form:"area"`
13 | Type string `json:"type" form:"type"`
14 | Order string `json:"order" form:"order"`
15 | }
16 |
17 | func (service *MvAllService) MvAll(c *gin.Context) map[string]interface{} {
18 |
19 | // 获得所有cookie
20 | cookies := c.Request.Cookies()
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 |
28 | tag := make(map[string]string)
29 | if service.Area == "" {
30 | service.Area = "全部"
31 | }
32 | if service.Type == "" {
33 | service.Type = "全部"
34 | }
35 | if service.Order == "" {
36 | service.Order = "上升最快"
37 | }
38 | tag["地区"] = service.Area
39 | tag["类型"] = service.Type
40 | tag["排序"] = service.Order
41 |
42 | tags, _ := json.Marshal(tag)
43 | data["tags"] = string(tags)
44 | if service.Limit == "" {
45 | data["limit"] = "30"
46 | } else {
47 | data["limit"] = service.Limit
48 | }
49 | if service.Offset == "" {
50 | data["offset"] = "0"
51 | } else {
52 | data["offset"] = service.Offset
53 | }
54 | data["order"] = "true"
55 | reBody, _ := util.CreateRequest("POST", `https://interface.music.163.com/api/mv/all`, data, options)
56 |
57 | return reBody
58 | }
59 |
--------------------------------------------------------------------------------
/service/mv_detailInfo_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MvDetailInfoService struct {
9 | ID string `json:"mvid" form:"mvid"`
10 | }
11 |
12 | func (service *MvDetailInfoService) MvDetailInfo(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["threadid"] = "R_MV_5_" + service.ID
23 | data["composeliked"] = "true"
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/comment/commentthread/info`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/mv_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MvDetailService struct {
9 | ID string `json:"mvid" form:"mvid"`
10 | }
11 |
12 | func (service *MvDetailService) MvDetail(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 |
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v1/mv/detail`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/mv_exclusive_rcmd_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MvExclusiveRcmdService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *MvExclusiveRcmdService) MvExclusiveRcmd(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "30"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://interface.music.163.com/api/mv/exclusive/rcmd`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/mv_first_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MvFirstService struct {
9 | Area string `json:"area" form:"area"`
10 | Limit string `json:"limit" form:"limit"`
11 | }
12 |
13 | func (service *MvFirstService) MvFirst(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["area"] = service.Area
24 | if service.Limit == "" {
25 | data["limit"] = "30"
26 | } else {
27 | data["limit"] = service.Limit
28 | }
29 |
30 | data["order"] = "true"
31 | reBody, _ := util.CreateRequest("POST", `https://interface.music.163.com/weapi/mv/first`, data, options)
32 |
33 | return reBody
34 | }
35 |
--------------------------------------------------------------------------------
/service/mv_sub_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MvSubService struct {
9 | T string `json:"t" form:"t"`
10 | MvId string `json:"mvid" form:"mvid"`
11 | }
12 |
13 | func (service *MvSubService) MvSub(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.T == "1" {
25 | service.T = "sub"
26 | } else {
27 | service.T = "unsub"
28 | }
29 |
30 | data["mvId"] = service.MvId
31 | data["mvIds"] = "[" + service.MvId + "]"
32 |
33 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/mv/`+service.T, data, options)
34 |
35 | return reBody
36 | }
37 |
--------------------------------------------------------------------------------
/service/mv_sublist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type MvSublistService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *MvSublistService) MvSublist(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.Limit == "" {
25 | service.Limit = "25"
26 | }
27 | if service.Offset == "" {
28 | service.Offset = "0"
29 | }
30 | data["limit"] = service.Limit
31 | data["offset"] = service.Offset
32 | data["total"] = "true"
33 |
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/cloudvideo/allvideo/sublist`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/mv_url_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type MvUrlService struct {
10 | ID string `json:"id" form:"id"`
11 | R string `json:"r" form:"r"`
12 | }
13 |
14 | func (service *MvUrlService) MvUrl(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
19 | cookies = append(cookies, cookiesOS)
20 |
21 | options := &util.Options{
22 | Crypto: "weapi",
23 | Cookies: cookies,
24 | }
25 | data := make(map[string]string)
26 | data["id"] = service.ID
27 | if service.R == "" {
28 | data["r"] = "1080"
29 | } else {
30 | data["r"] = service.R
31 | }
32 |
33 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/song/enhance/play/mv/url`, data, options)
34 |
35 | return reBody
36 | }
37 |
--------------------------------------------------------------------------------
/service/personal_fm_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PersonalFmService struct {
9 | }
10 |
11 | func (service *PersonalFmService) PersonalFm(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/radio/get`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/personalized_djprogram_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PersonalizedDjprogramService struct {
9 | ID string `json:"id" form:"id"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *PersonalizedDjprogramService) PersonalizedDjprogram(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 |
25 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/personalized/djprogram`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/personalized_mv_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PersonalizedMvService struct {
9 | ID string `json:"id" form:"id"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *PersonalizedMvService) PersonalizedMv(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 |
25 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/personalized/mv`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/personalized_newsong_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PersonalizedNewsongService struct {
9 | }
10 |
11 | func (service *PersonalizedNewsongService) PersonalizedNewsong(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 |
22 | data["type"] = "recommend"
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/personalized/newsong`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/personalized_privatecontent_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PersonalizedPrivatecontentListService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *PersonalizedPrivatecontentListService) PersonalizedPrivatecontentList(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "60"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v2/privatecontent/list`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/personalized_privatecontent_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PersonalizedPrivatecontentService struct {
9 | }
10 |
11 | func (service *PersonalizedPrivatecontentService) PersonalizedPrivatecontent(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 |
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/personalized/privatecontent`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/personalized_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type PersonalizedService struct {
10 | Limit string `json:"limit" form:"limit"`
11 | }
12 |
13 | func (service *PersonalizedService) Personalized(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | data["order"] = "true"
31 | data["n"] = "1000"
32 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/personalized/playlist`, data, options)
33 |
34 | return reBody
35 | }
36 |
--------------------------------------------------------------------------------
/service/playlist_catlist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistCatlistService struct{}
9 |
10 | func (service *PlaylistCatlistService) PlaylistCatlist(c *gin.Context) map[string]interface{} {
11 |
12 | // 获得所有cookie
13 | cookies := c.Request.Cookies()
14 |
15 | options := &util.Options{
16 | Crypto: "weapi",
17 | Cookies: cookies,
18 | }
19 | data := make(map[string]string)
20 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/catalogue`, data, options)
21 |
22 | return reBody
23 | }
24 |
--------------------------------------------------------------------------------
/service/playlist_create_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type PlaylistCreateService struct {
10 | Name string `json:"name" form:"name"`
11 | Privacy string `json:"privacy" form:"privacy"`
12 | }
13 |
14 | func (service *PlaylistCreateService) PlaylistCreate(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
19 | cookies = append(cookies, cookiesOS)
20 |
21 | options := &util.Options{
22 | Crypto: "weapi",
23 | Cookies: cookies,
24 | }
25 | data := make(map[string]string)
26 | if service.Privacy != "10" {
27 | service.Privacy = "0"
28 | }
29 | data["name"] = service.Name
30 | data["privacy"] = service.Privacy
31 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/create`, data, options)
32 |
33 | return reBody
34 | }
35 |
--------------------------------------------------------------------------------
/service/playlist_delete_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type PlaylistDeleteService struct {
10 | ID string `json:"id" form:"id"`
11 | }
12 |
13 | func (service *PlaylistDeleteService) PlaylistDelete(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | data["ids"] = "[" + service.ID + "]"
26 |
27 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/remove`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/playlist_desc_update_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistDescUpdateService struct {
9 | Id string `json:"id" form:"id"`
10 | Desc string `json:"desc" form:"desc"`
11 | }
12 |
13 | func (service *PlaylistDescUpdateService) PlaylistDescUpdate(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "eapi",
20 | Cookies: cookies,
21 | Url: "/api/playlist/desc/update",
22 | }
23 | data := make(map[string]string)
24 | data["id"] = service.Id
25 | data["desc"] = service.Desc
26 | reBody, _ := util.CreateRequest("POST", `http://interface3.music.163.com/eapi/playlist/desc/update`, data, options)
27 |
28 | return reBody
29 | }
30 |
--------------------------------------------------------------------------------
/service/playlist_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistDetailService struct {
9 | Id string `json:"id" form:"id"`
10 | S string `json:"s" form:"s"`
11 | }
12 |
13 | func (service *PlaylistDetailService) PlaylistDetail(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "linuxapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.S == "" {
24 | service.S = "8"
25 | }
26 | data["id"] = service.Id
27 | data["n"] = "100000"
28 | data["s"] = service.S
29 |
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v3/playlist/detail`, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/playlist_hot_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistHotService struct{}
9 |
10 | func (service *PlaylistHotService) PlaylistHot(c *gin.Context) map[string]interface{} {
11 |
12 | // 获得所有cookie
13 | cookies := c.Request.Cookies()
14 |
15 | options := &util.Options{
16 | Crypto: "weapi",
17 | Cookies: cookies,
18 | }
19 | data := make(map[string]string)
20 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/hottags`, data, options)
21 |
22 | return reBody
23 | }
24 |
--------------------------------------------------------------------------------
/service/playlist_name_update_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistNameUpdateService struct {
9 | Id string `json:"id" form:"id"`
10 | Name string `json:"desc" form:"name"`
11 | }
12 |
13 | func (service *PlaylistNameUpdateService) PlaylistNameUpdate(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "eapi",
20 | Cookies: cookies,
21 | Url: "/api/playlist/update/name",
22 | }
23 | data := make(map[string]string)
24 | data["id"] = service.Id
25 | data["name"] = service.Name
26 | reBody, _ := util.CreateRequest("POST", `http://interface3.music.163.com/eapi/playlist/update/name`, data, options)
27 |
28 | return reBody
29 | }
30 |
--------------------------------------------------------------------------------
/service/playlist_order_update_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type PlaylistOrderUpdateService struct {
10 | Ids string `json:"ids" form:"ids"`
11 | }
12 |
13 | func (service *PlaylistOrderUpdateService) PlaylistOrderUpdate(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | data["id"] = service.Ids
26 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/playlist/order/update`, data, options)
27 |
28 | return reBody
29 | }
30 |
--------------------------------------------------------------------------------
/service/playlist_subscribe_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistSubscribeService struct {
9 | T string `json:"t" form:"t"`
10 | ID string `json:"id" form:"id"`
11 | }
12 |
13 | func (service *PlaylistSubscribeService) PlaylistSubscribe(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["id"] = service.ID
24 | if service.T == "1" {
25 | service.T = "subscribe"
26 | } else {
27 | service.T = "unsubscribe"
28 | }
29 |
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/`+service.T, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/playlist_subscribers_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistSubscribersService struct {
9 | ID string `json:"id" form:"id"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *PlaylistSubscribersService) PlaylistSubscribers(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["id"] = service.ID
25 | if service.Limit == "" {
26 | data["limit"] = "20"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | data["order"] = "true"
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/subscribers`, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/playlist_tags_update_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistTagsUpdateService struct {
9 | Id string `json:"id" form:"id"`
10 | Tags string `json:"tags" form:"tags"`
11 | }
12 |
13 | func (service *PlaylistTagsUpdateService) PlaylistTagsUpdate(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "eapi",
20 | Cookies: cookies,
21 | Url: "/api/playlist/tags/update",
22 | }
23 | data := make(map[string]string)
24 | data["id"] = service.Id
25 | data["tags"] = service.Tags
26 | reBody, _ := util.CreateRequest("POST", `http://interface3.music.163.com/eapi/playlist/tags/update`, data, options)
27 |
28 | return reBody
29 | }
30 |
--------------------------------------------------------------------------------
/service/playlist_tracks_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaylistTracksService struct {
9 | Op string `json:"op" form:"op"`
10 | Pid string `json:"pid" form:"pid"`
11 | TrackIds string `json:"tracks" form:"tracks"`
12 | }
13 |
14 | func (service *PlaylistTracksService) PlaylistTracks(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["op"] = service.Op
25 | data["pid"] = service.Pid
26 | data["trackIds"] = "[" + service.TrackIds + "]"
27 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/manipulate/tracks`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/playlist_update_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type PlaylistUpdateService struct {
10 | Id string `json:"id" form:"id"`
11 | Name string `json:"name" form:"name"`
12 | Desc string `json:"desc" form:"desc"`
13 | Tags string `json:"tags" form:"tags"`
14 | }
15 |
16 | func (service *PlaylistUpdateService) PlaylistUpdate(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["/api/playlist/desc/update"] = `{"id":` + service.Id + `,"desc":"` + service.Desc + `"}`
29 | data["/api/playlist/tags/update"] = `{"id":` + service.Id + `,"tags":"` + service.Tags + `"}`
30 | data["/api/playlist/update/name"] = `{"id":` + service.Id + `,"name":"` + service.Name + `"}`
31 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/batch`, data, options)
32 |
33 | return reBody
34 | }
35 |
--------------------------------------------------------------------------------
/service/playmode_intelligence_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type PlaymodeIntelligenceListService struct {
9 | SongId string `json:"id" form:"id"`
10 | PlaylistId string `json:"pid" form:"pid"`
11 | StartMusicId string `json:"sid" form:"sid"`
12 | Count string `json:"count" form:"count"`
13 | }
14 |
15 | func (service *PlaymodeIntelligenceListService) PlaymodeIntelligenceList(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 |
26 | data["songId"] = service.SongId
27 | data["type"] = "fromPlayOne"
28 | data["playlistId"] = service.PlaylistId
29 | if service.StartMusicId != "" {
30 | data["startMusicId"] = service.StartMusicId
31 | } else {
32 | data["startMusicId"] = service.SongId
33 | }
34 | if data["count"] == "" {
35 | data["count"] = "1"
36 | } else {
37 | data["count"] = service.Count
38 | }
39 |
40 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/playmode/intelligence/list`, data, options)
41 |
42 | return reBody
43 | }
44 |
--------------------------------------------------------------------------------
/service/program_recommend_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ProgramRecommendService struct {
9 | CateId string `json:"type" form:"type"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *ProgramRecommendService) ProgramRecommend(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["cateId"] = service.CateId
25 | if service.Limit == "" {
26 | data["limit"] = "10"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | data["order"] = "true"
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/program/recommend/v1`, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/rebind_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type RebindService struct {
9 | Captcha string `json:"captcha" form:"captcha"`
10 | Phone string `json:"phone" form:"phone"`
11 | Oldcaptcha string `json:"oldcaptcha" form:"oldcaptcha"`
12 | Ctcode string `json:"ctcode" form:"ctcode"`
13 | }
14 |
15 | func (service *RebindService) Rebind(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 |
26 | data["phone"] = service.Phone
27 | data["captcha"] = service.Captcha
28 | data["captcha"] = service.Captcha
29 | data["oldcaptcha"] = service.Oldcaptcha
30 |
31 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/user/replaceCellphone`, data, options)
32 |
33 | return reBody
34 | }
35 |
--------------------------------------------------------------------------------
/service/recommend_resource_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type RecommendResourceService struct {
9 | }
10 |
11 | func (service *RecommendResourceService) RecommendResource(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/discovery/recommend/resource`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/recommend_songs_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type RecommendSongsService struct {
10 | ID string `json:"id" form:"id"`
11 | }
12 |
13 | func (service *RecommendSongsService) RecommendSongs(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "ios"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/v3/discovery/recommend/songs`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/related_all_video_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type RelatedAllVideoService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *RelatedAllVideoService) RelatedAllVideo(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 | data["type"] = "1"
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/cloudvideo/v1/allvideo/rcmd`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/related_playlist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "regexp"
6 | "singo/util"
7 | )
8 |
9 | type RelatedPlaylistService struct {
10 | ID string `json:"id" form:"id"`
11 | }
12 |
13 | func (service *RelatedPlaylistService) RelatedPlaylist(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | Ua: "pc",
22 | }
23 | data := make(map[string]string)
24 |
25 | reBody, _ := util.CreateRequest("GET", `https://music.163.com/playlist?id=`+service.ID, data, options)
26 |
27 | reg := regexp.MustCompile("
[\\s\\S]*?
\")
[\\s\\S]*?
]*>([^<]+?)<\\/a>[\\s\\S]*?]*>([^<]+?)<\\/a>")
28 | results := reg.FindAllStringSubmatch(reBody["html"].(string), -1)
29 |
30 | type Creator struct {
31 | UserId string `json:"userId"`
32 | Nickname string `json:"nickname"`
33 | }
34 |
35 | type Result struct {
36 | Id string `json:"id"`
37 | Name string `json:"name"`
38 | CoverImgUrl string `json:"coverImgUrl"`
39 | Creator Creator `json:"creator"`
40 | }
41 | var Results []Result
42 | for _, result := range results {
43 | var item Result
44 | item.Id = result[2][len("/playlist?id="):]
45 | item.Name = result[3]
46 | item.CoverImgUrl = result[1][0 : len(result[1])-len("?param=50y50")]
47 | item.Creator.UserId = result[4][len("/user/home?id="):]
48 | item.Creator.Nickname = result[5]
49 | Results = append(Results, item)
50 | }
51 |
52 | delete(reBody, "html")
53 | reBody["playlists"] = Results
54 | return reBody
55 | }
56 |
--------------------------------------------------------------------------------
/service/resource_like_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type ResourceLikeService struct {
10 | ID string `json:"id" form:"id"`
11 | ThreadId string `json:"threadId" form:"threadId"`
12 | T string `json:"t" form:"t"`
13 | Type string `json:"type" form:"type"`
14 | }
15 |
16 | func (service *ResourceLikeService) ResourceLike(c *gin.Context) map[string]interface{} {
17 |
18 | // 获得所有cookie
19 | cookies := c.Request.Cookies()
20 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
21 | cookies = append(cookies, cookiesOS)
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | TYPE := make(map[string]string, 6)
28 | TYPE["1"] = "R_MV_5_"
29 | TYPE["4"] = "A_DJ_1_"
30 | TYPE["5"] = "R_VI_62_"
31 | TYPE["6"] = "A_EV_2_"
32 |
33 | if _, ok := TYPE[service.Type]; ok {
34 | service.Type = TYPE[service.Type]
35 | } else {
36 | service.Type = TYPE["1"]
37 | }
38 |
39 | data := make(map[string]string)
40 | data["threadId"] = service.Type + service.ID
41 |
42 | if service.Type == "A_EV_2_" {
43 | data["threadId"] = service.ThreadId
44 | }
45 |
46 | if service.T == "1" {
47 | service.T = "like"
48 | } else {
49 | service.T = "unlike"
50 | }
51 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/resource/`+service.T, data, options)
52 |
53 | return reBody
54 | }
55 |
--------------------------------------------------------------------------------
/service/scrobble_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/gin-gonic/gin"
6 | "singo/util"
7 | )
8 |
9 | type ScrobbleService struct {
10 | ID string `json:"id" form:"id"`
11 | Sourceid string `json:"sourceid" form:"sourceid"`
12 | Time string `json:"time" form:"time"`
13 | }
14 |
15 | func (service *ScrobbleService) Scrobble(c *gin.Context) map[string]interface{} {
16 |
17 | //errBody:=make(map[string]interface{})
18 | //errBody["code"]=500
19 | //errBody["err"]="此接口本后台暂未实现,,,欢迎pr"
20 | //return errBody
21 |
22 | // 获得所有cookie
23 | cookies := c.Request.Cookies()
24 |
25 | options := &util.Options{
26 | Crypto: "weapi",
27 | Cookies: cookies,
28 | }
29 | data := make(map[string]string)
30 |
31 | jsonn := make(map[string]interface{})
32 | jsonn["download"] = 0
33 | jsonn["end"] = "playend"
34 | jsonn["id"] = service.ID
35 | jsonn["sourceId"] = service.Sourceid
36 | jsonn["time"] = service.Time
37 | jsonn["type"] = "song"
38 | jsonn["wifi"] = 0
39 |
40 | long := make(map[string]interface{})
41 | long["action"] = "play"
42 | long["json"] = jsonn
43 |
44 | var longs []map[string]interface{}
45 | longs = append(longs, long)
46 |
47 | if str, err := json.Marshal(longs); err != nil {
48 | errBody := make(map[string]interface{})
49 | errBody["code"] = 502
50 | errBody["err"] = "参数错误"
51 | return errBody
52 | } else {
53 | data["long"] = string(str)
54 | }
55 |
56 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/feedback/weblog`, data, options)
57 |
58 | return reBody
59 | }
60 |
--------------------------------------------------------------------------------
/service/search_default_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SearchDefaultService struct {
9 | }
10 |
11 | func (service *SearchDefaultService) SearchDefault(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "eapi",
18 | Cookies: cookies,
19 | Url: "/api/search/defaultkeyword/get",
20 | }
21 | data := make(map[string]string)
22 |
23 | reBody, _ := util.CreateRequest("POST", `http://interface3.music.163.com/eapi/search/defaultkeyword/get`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/search_hot_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SearchHotDetailService struct {
9 | }
10 |
11 | func (service *SearchHotDetailService) SearchHotDetail(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 |
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/hotsearchlist/get`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/search_hot_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SearchHotService struct {
9 | }
10 |
11 | func (service *SearchHotService) SearchHot(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | Ua: "mobile",
20 | }
21 | data := make(map[string]string)
22 | data["type"] = "1111"
23 |
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/search/hot`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/search_multimatch_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SearchMultimatchService struct {
9 | Type string `json:"type" form:"type"`
10 | S string `json:"keywords" form:"keywords"`
11 | }
12 |
13 | func (service *SearchMultimatchService) SearchMultimatch(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Type == "" {
24 | service.Type = "1"
25 | }
26 | data["type"] = service.Type
27 | data["s"] = service.S
28 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/search/suggest/multimatch`, data, options)
29 |
30 | return reBody
31 | }
32 |
--------------------------------------------------------------------------------
/service/search_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SearchService struct {
9 | S string `json:"keywords" form:"keywords"`
10 | Type string `json:"type" form:"type"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | }
14 |
15 | func (service *SearchService) Search(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 |
26 | if service.Type == "" {
27 | service.Type = "1"
28 | }
29 | if service.Limit == "" {
30 | service.Limit = "30"
31 | }
32 | if service.Offset == "" {
33 | service.Offset = "0"
34 | }
35 | data["limit"] = service.Limit
36 | data["offset"] = service.Offset
37 | data["type"] = service.Type
38 | data["s"] = service.S
39 |
40 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/search/get`, data, options)
41 |
42 | return reBody
43 | }
44 |
--------------------------------------------------------------------------------
/service/search_suggest_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SearchSuggestService struct {
9 | S string `json:"keywords" form:"keywords"`
10 | Type string `json:"type" form:"type"`
11 | }
12 |
13 | func (service *SearchSuggestService) SearchSuggest(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.Type == "mobile" {
25 | service.Type = "keyword"
26 | } else {
27 | service.Type = "web"
28 | }
29 | data["s"] = service.S
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/search/suggest/`+service.Type, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/send_playlist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type SendPlaylistService struct {
10 | ID string `json:"playlist" form:"playlist"`
11 | Msg string `json:"msg" form:"msg"`
12 | UserIds string `json:"user_ids" form:"user_ids"`
13 | }
14 |
15 | func (service *SendPlaylistService) SendPlaylist(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | data["id"] = service.ID
28 | data["type"] = "playlist"
29 | data["msg"] = service.Msg
30 | data["userIds"] = "[" + service.UserIds + "]"
31 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/msg/private/send`, data, options)
32 |
33 | return reBody
34 | }
35 |
--------------------------------------------------------------------------------
/service/send_text_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type SendTextService struct {
10 | ID string `json:"playlist" form:"playlist"`
11 | Msg string `json:"msg" form:"msg"`
12 | UserIds string `json:"user_ids" form:"user_ids"`
13 | }
14 |
15 | func (service *SendTextService) SendText(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | data["id"] = service.ID
28 | data["type"] = "text"
29 | data["msg"] = service.Msg
30 | data["userIds"] = "[" + service.UserIds + "]"
31 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/msg/private/send`, data, options)
32 |
33 | return reBody
34 | }
35 |
--------------------------------------------------------------------------------
/service/setting_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SettingService struct {
9 | }
10 |
11 | func (service *SettingService) Setting(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/user/setting`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/share_resource_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ShareResourceService struct {
9 | Id string `json:"id" form:"id"`
10 | Msg string `json:"msg" form:"msg"`
11 | Type string `json:"type" form:"type"`
12 | }
13 |
14 | func (service *ShareResourceService) ShareResource(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["id"] = service.Id
25 | data["msg"] = service.Msg
26 |
27 | if service.Type == "" {
28 | data["type"] = "song"
29 | } else {
30 | data["type"] = service.Type
31 | }
32 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/share/friends/resource`, data, options)
33 |
34 | return reBody
35 | }
36 |
--------------------------------------------------------------------------------
/service/simi_artist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SimiArtistService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *SimiArtistService) SimiArtist(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 |
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/discovery/simiArtist`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/simi_mv_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SimiMvService struct {
9 | ID string `json:"mvid" form:"mvid"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *SimiMvService) SimiMv(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["mvid"] = service.ID
25 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/discovery/simiMV`, data, options)
26 |
27 | return reBody
28 | }
29 |
--------------------------------------------------------------------------------
/service/simi_playlist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type SimiPlaylistService struct {
10 | ID string `json:"id" form:"id"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | }
14 |
15 | func (service *SimiPlaylistService) SimiPlaylist(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | data["songid"] = service.ID
28 | if service.Limit == "" {
29 | data["limit"] = "30"
30 | } else {
31 | data["limit"] = service.Limit
32 | }
33 | if service.Offset == "" {
34 | data["offset"] = "0"
35 | } else {
36 | data["offset"] = service.Offset
37 | }
38 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/discovery/simiPlaylist`, data, options)
39 |
40 | return reBody
41 | }
42 |
--------------------------------------------------------------------------------
/service/simi_song_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SimiSongService struct {
9 | ID string `json:"id" form:"id"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *SimiSongService) SimiSong(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["songid"] = service.ID
24 | if service.Limit == "" {
25 | data["limit"] = "30"
26 | } else {
27 | data["limit"] = service.Limit
28 | }
29 | if service.Offset == "" {
30 | data["offset"] = "0"
31 | } else {
32 | data["offset"] = service.Offset
33 | }
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/discovery/simiSong`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/simi_user_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SimiUserService struct {
9 | ID string `json:"id" form:"id"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *SimiUserService) SimiUser(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["songid"] = service.ID
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 |
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/discovery/simiUser`, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/song_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/gin-gonic/gin"
6 | "net/http"
7 | "singo/util"
8 | "strings"
9 | )
10 |
11 | type SongDetailService struct {
12 | Ids string `json:"ids" form:"ids"`
13 | }
14 |
15 | func (service *SongDetailService) SongDetail(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 |
27 | type IDS struct {
28 | ID string `json:"id"`
29 | }
30 |
31 | var cids []IDS
32 |
33 | strs := strings.Split(service.Ids, ",")
34 | for _, item := range strs {
35 | cids = append(cids, IDS{ID: item})
36 | }
37 | sidsJsonByte, _ := json.Marshal(cids)
38 |
39 | data := make(map[string]string)
40 | data["c"] = string(sidsJsonByte)
41 | data["ids"] = "[" + service.Ids + "]"
42 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v3/song/detail`, data, options)
43 |
44 | return reBody
45 | }
46 |
--------------------------------------------------------------------------------
/service/song_order_update_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type SongOrderUpdateService struct {
9 | Pid string `json:"pid" form:"pid"`
10 | Ids string `json:"ids" form:"ids"`
11 | }
12 |
13 | func (service *SongOrderUpdateService) SongOrderUpdate(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | Url: "/api/playlist/desc/update",
22 | }
23 | data := make(map[string]string)
24 | data["pid"] = service.Pid
25 | data["trackIds"] = service.Ids
26 | data["op"] = "update"
27 | reBody, _ := util.CreateRequest("POST", `http://interface.music.163.com/api/playlist/manipulate/tracks`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/song_url_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "encoding/hex"
5 | "github.com/gin-gonic/gin"
6 | "net/http"
7 | "singo/util"
8 | )
9 |
10 | type SongUrlService struct {
11 | ID string `json:"id" form:"id"`
12 | Br string `json:"br" form:"br"`
13 | }
14 |
15 | func (service *SongUrlService) SongUrl(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | var f = false
23 |
24 | for _, item := range cookies {
25 | if item.Name == "MUSIC_U" {
26 | f = true
27 | break
28 | }
29 | }
30 |
31 | if f {
32 | cookieNuid := &http.Cookie{Name: "_ntes_nuid", Value: hex.EncodeToString([]byte(util.RandStringRunes(16)))}
33 | cookies = append(cookies, cookieNuid)
34 | }
35 |
36 | options := &util.Options{
37 | Crypto: "linuxapi",
38 | Cookies: cookies,
39 | }
40 | data := make(map[string]string)
41 | data["ids"] = "[" + service.ID + "]"
42 | if service.Br == "" {
43 | service.Br = "999000"
44 | }
45 | data["br"] = service.Br
46 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/song/enhance/player/url`, data, options)
47 |
48 | return reBody
49 | }
50 |
--------------------------------------------------------------------------------
/service/top_album_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | "strconv"
8 | "time"
9 | )
10 |
11 | type TopAlbumService struct {
12 | Area string `json:"area" form:"area"` //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本
13 | Limit string `json:"limit" form:"limit"`
14 | Offset string `json:"offset" form:"offset"`
15 | Type string `json:"type" form:"type"`
16 | Year string `json:"year" form:"year"`
17 | Month string `json:"month" form:"month"`
18 | }
19 |
20 | func (service *TopAlbumService) TopAlbum(c *gin.Context) map[string]interface{} {
21 |
22 | // 获得所有cookie
23 | cookies := c.Request.Cookies()
24 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
25 | cookies = append(cookies, cookiesOS)
26 |
27 | options := &util.Options{
28 | Crypto: "weapi",
29 | Cookies: cookies,
30 | }
31 | data := make(map[string]string)
32 |
33 | if service.Area == "" {
34 | service.Area = "ALL"
35 | }
36 | if service.Limit == "" {
37 | service.Limit = "50"
38 | }
39 | if service.Offset == "" {
40 | service.Offset = "0"
41 | }
42 | if service.Type == "" {
43 | service.Type = "new"
44 | }
45 | if service.Year == "" {
46 | service.Year = strconv.Itoa(time.Now().Year())
47 | }
48 | if service.Month == "" {
49 | service.Month = strconv.Itoa(int(time.Now().Month()))
50 | }
51 | data["area"] = service.Area
52 | data["limit"] = service.Limit
53 | data["offset"] = service.Offset
54 | data["type"] = service.Type
55 | data["year"] = service.Year
56 | data["month"] = service.Month
57 | data["total"] = "true"
58 | data["rcmd"] = "false"
59 |
60 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/discovery/new/albums/area`, data, options)
61 |
62 | return reBody
63 | }
64 |
--------------------------------------------------------------------------------
/service/top_artists_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type TopArtistsService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *TopArtistsService) TopArtists(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.Limit == "" {
25 | data["limit"] = "50"
26 | } else {
27 | data["limit"] = service.Limit
28 | }
29 | if service.Offset == "" {
30 | data["offset"] = "0"
31 | } else {
32 | data["offset"] = service.Offset
33 | }
34 | data["order"] = "true"
35 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/artist/top`, data, options)
36 |
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/top_mv_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type TopMvService struct {
10 | Area string `json:"area" form:"area"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | }
14 |
15 | func (service *TopMvService) TopMv(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | data["area"] = service.Area
28 | if service.Limit == "" {
29 | data["limit"] = "30"
30 | } else {
31 | data["limit"] = service.Limit
32 | }
33 | if service.Offset == "" {
34 | data["offset"] = "0"
35 | } else {
36 | data["offset"] = service.Offset
37 | }
38 | data["order"] = "true"
39 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/mv/toplist`, data, options)
40 |
41 | return reBody
42 | }
43 |
--------------------------------------------------------------------------------
/service/top_playlist_highquality_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type TopPlaylistHighqualityService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Cat string `json:"cat" form:"cat"`
11 | LastTime string `json:"lasttime" form:"lasttime"`
12 | }
13 |
14 | func (service *TopPlaylistHighqualityService) TopPlaylistHighquality(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 |
25 | if service.Cat == "" {
26 | service.Cat = "全部"
27 | }
28 | if service.Limit == "" {
29 | service.Limit = "50"
30 | }
31 | if service.LastTime == "" {
32 | service.LastTime = "0"
33 | }
34 | data["limit"] = service.Limit
35 | data["lasttime"] = service.LastTime
36 | data["total"] = "true"
37 | data["cat"] = service.Cat
38 |
39 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/highquality/list`, data, options)
40 |
41 | return reBody
42 | }
43 |
--------------------------------------------------------------------------------
/service/top_playlist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type TopPlaylistService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Cat string `json:"cat" form:"cat"`
11 | Order string `json:"order" form:"order"`
12 | Offset string `json:"offset" form:"offset"`
13 | }
14 |
15 | func (service *TopPlaylistService) TopPlaylist(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 |
26 | if service.Cat == "" {
27 | service.Cat = "全部"
28 | }
29 | if service.Limit == "" {
30 | service.Limit = "50"
31 | }
32 | if service.Offset == "" {
33 | service.Offset = "0"
34 | }
35 | if service.Order != "hot" {
36 | service.Order = "new"
37 | }
38 | data["limit"] = service.Limit
39 | data["offset"] = service.Offset
40 | data["total"] = "true"
41 | data["hot"] = service.Order
42 | data["cat"] = service.Cat
43 |
44 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/playlist/list`, data, options)
45 |
46 | return reBody
47 | }
48 |
--------------------------------------------------------------------------------
/service/top_song_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type TopSongService struct {
9 | AreaId string `json:"type" form:"type"`
10 | }
11 |
12 | func (service *TopSongService) TopSong(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | if service.AreaId == "" {
23 | service.AreaId = "0"
24 | }
25 | data["areaId"] = service.AreaId
26 | data["total"] = "true"
27 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/discovery/new/songs`, data, options)
28 |
29 | return reBody
30 | }
31 |
--------------------------------------------------------------------------------
/service/toplist_artist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type ToplistArtistService struct {
10 | Type string `json:"type" form:"type"`
11 | Limit string `json:"limit" form:"limit"`
12 | Offset string `json:"offset" form:"offset"`
13 | }
14 |
15 | func (service *ToplistArtistService) ToplistArtist(c *gin.Context) map[string]interface{} {
16 |
17 | // 获得所有cookie
18 | cookies := c.Request.Cookies()
19 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
20 | cookies = append(cookies, cookiesOS)
21 |
22 | options := &util.Options{
23 | Crypto: "weapi",
24 | Cookies: cookies,
25 | }
26 | data := make(map[string]string)
27 | if service.Type == "" {
28 | data["type"] = "1"
29 | } else {
30 | data["type"] = service.Type
31 | }
32 | if service.Limit == "" {
33 | data["limit"] = "100"
34 | } else {
35 | data["limit"] = service.Limit
36 | }
37 | if service.Offset == "" {
38 | data["offset"] = "0"
39 | } else {
40 | data["offset"] = service.Offset
41 | }
42 | data["order"] = "true"
43 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/toplist/artist`, data, options)
44 |
45 | return reBody
46 | }
47 |
--------------------------------------------------------------------------------
/service/toplist_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ToplistDetailService struct {
9 | }
10 |
11 | func (service *ToplistDetailService) ToplistDetail(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 |
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/toplist/detail`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/toplist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type ToplistService struct {
9 | }
10 |
11 | func (service *ToplistService) Toplist(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "linuxapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 |
22 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/toplist`, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/user_audio_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserAudioService struct {
9 | UID string `json:"uid" form:"uid"`
10 | }
11 |
12 | func (service *UserAudioService) UserAudio(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["userId"] = service.UID
23 |
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/djradio/get/byuser`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/user_cloud_del_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserCloudDelService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *UserCloudDelService) UserCloudDel(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["songIds"] = "[" + service.ID + "]"
23 | reBody, _ := util.CreateRequest("POST", `http://music.163.com/weapi/cloud/del`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/user_cloud_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserCloudDetailService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *UserCloudDetailService) UserCloudDetail(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["songIds"] = "[" + service.ID + "]"
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/cloud/get/byids`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/user_cloud_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type UserCloudService struct {
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *UserCloudService) UserCloud(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
19 | cookies = append(cookies, cookiesOS)
20 |
21 | options := &util.Options{
22 | Crypto: "weapi",
23 | Cookies: cookies,
24 | }
25 | data := make(map[string]string)
26 | if service.Limit == "" {
27 | data["limit"] = "30"
28 | } else {
29 | data["limit"] = service.Limit
30 | }
31 | if service.Offset == "" {
32 | data["offset"] = "0"
33 | } else {
34 | data["offset"] = service.Offset
35 | }
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/cloud/get`, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/user_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserDetailService struct {
9 | Uid string `json:"uid" form:"uid"`
10 | }
11 |
12 | func (service *UserDetailService) UserDetail(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/v1/user/detail/`+service.Uid, data, options)
23 |
24 | return reBody
25 | }
26 |
--------------------------------------------------------------------------------
/service/user_dj_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserDjService struct {
9 | Uid string `json:"uid" form:"uid"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *UserDjService) UserDj(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["uid"] = service.Uid
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/dj/program/`+service.Uid, data, options)
36 |
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/user_event_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserEventService struct {
9 | Uid string `json:"uid" form:"uid"`
10 | Limit string `json:"limit" form:"limit"`
11 | Time string `json:"lasttime " form:"lasttime "`
12 | }
13 |
14 | func (service *UserEventService) UserEvent(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["getcounts"] = "true"
25 | data["total"] = "false"
26 | if service.Limit == "" {
27 | data["limit"] = "30"
28 | } else {
29 | data["limit"] = service.Limit
30 | }
31 | if service.Time == "" {
32 | data["time"] = "-1"
33 | } else {
34 | data["time"] = service.Time
35 | }
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/event/get/`+service.Uid, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/user_followeds_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserFollowedsService struct {
9 | Uid string `json:"uid" form:"uid"`
10 | Limit string `json:"limit" form:"limit"`
11 | Time string `json:"lasttime " form:"lasttime "`
12 | }
13 |
14 | func (service *UserFollowedsService) UserFolloweds(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "eapi",
21 | Cookies: cookies,
22 | Url: "/api/user/getfolloweds",
23 | }
24 | data := make(map[string]string)
25 | data["userId"] = service.Uid
26 | if service.Limit == "" {
27 | data["limit"] = "30"
28 | } else {
29 | data["limit"] = service.Limit
30 | }
31 | if service.Time == "" {
32 | data["time"] = "-1"
33 | } else {
34 | data["time"] = service.Time
35 | }
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/eapi/user/getfolloweds/`+service.Uid, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/user_follows_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserFollowsService struct {
9 | Uid string `json:"uid" form:"uid"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *UserFollowsService) UserFollows(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["uid"] = service.Uid
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | data["order"] = "true"
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/user/getfollows/`+service.Uid, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/user_playlist_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserPlaylistService struct {
9 | Uid string `json:"uid" form:"uid"`
10 | Limit string `json:"limit" form:"limit"`
11 | Offset string `json:"offset" form:"offset"`
12 | }
13 |
14 | func (service *UserPlaylistService) UserPlaylist(c *gin.Context) map[string]interface{} {
15 |
16 | // 获得所有cookie
17 | cookies := c.Request.Cookies()
18 |
19 | options := &util.Options{
20 | Crypto: "weapi",
21 | Cookies: cookies,
22 | }
23 | data := make(map[string]string)
24 | data["uid"] = service.Uid
25 | if service.Limit == "" {
26 | data["limit"] = "30"
27 | } else {
28 | data["limit"] = service.Limit
29 | }
30 | if service.Offset == "" {
31 | data["offset"] = "0"
32 | } else {
33 | data["offset"] = service.Offset
34 | }
35 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/user/playlist`, data, options)
36 |
37 | return reBody
38 | }
39 |
--------------------------------------------------------------------------------
/service/user_record_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserRecordService struct {
9 | UId string `json:"uid" form:"uid"`
10 | Type string `json:"type" form:"type"`
11 | }
12 |
13 | func (service *UserRecordService) UserRecord(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["uid"] = service.UId
24 |
25 | if service.Type == "1" {
26 | data["type"] = "1"
27 | } else {
28 | data["type"] = "0"
29 | }
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/v1/play/record`, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/user_subcount_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserSubcountService struct {
9 | }
10 |
11 | func (service *UserSubcountService) UserSubcount(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, cookies := util.CreateRequest("POST", `https://music.163.com/weapi/subcount`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/user_update_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type UserUpdateService struct {
9 | AvatarImgId string
10 | Birthday string `json:"birthday" form:"birthday"`
11 | City string `json:"city" form:"city"`
12 | Gender string `json:"gender" form:"gender"`
13 | Nickname string `json:"nickname" form:"nickname"`
14 | Province string `json:"province" form:"province"`
15 | Signature string `json:"signature" form:"signature"`
16 | }
17 |
18 | func (service *UserUpdateService) UserUpdate(c *gin.Context) map[string]interface{} {
19 |
20 | // 获得所有cookie
21 | cookies := c.Request.Cookies()
22 |
23 | options := &util.Options{
24 | Crypto: "weapi",
25 | Cookies: cookies,
26 | }
27 | data := make(map[string]string)
28 | data["avatarImgId"] = "0"
29 | data["birthday"] = service.Birthday
30 | data["city"] = service.City
31 | data["gender"] = service.Gender
32 | data["nickname"] = service.Nickname
33 | data["province"] = service.Province
34 | data["signature"] = service.Signature
35 |
36 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/user/profile/update`, data, options)
37 |
38 | return reBody
39 | }
40 |
--------------------------------------------------------------------------------
/service/video_category_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoCategoryListService struct {
9 | Limit string `json:"limit" form:"limit"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *VideoCategoryListService) VideoCategoryList(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Limit == "" {
24 | data["limit"] = "99"
25 | } else {
26 | data["limit"] = service.Limit
27 | }
28 | if service.Offset == "" {
29 | data["offset"] = "0"
30 | } else {
31 | data["offset"] = service.Offset
32 | }
33 | data["order"] = "true"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/cloudvideo/category/list`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/video_detail_info_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoDetailInfoService struct {
9 | ID string `json:"vid" form:"vid"`
10 | }
11 |
12 | func (service *VideoDetailInfoService) VideoDetailInfo(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["threadid"] = "R_VI_62_" + service.ID
23 | data["composeliked"] = "true"
24 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/comment/commentthread/info`, data, options)
25 |
26 | return reBody
27 | }
28 |
--------------------------------------------------------------------------------
/service/video_detail_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoDetailService struct {
9 | ID string `json:"id" form:"id"`
10 | }
11 |
12 | func (service *VideoDetailService) VideoDetail(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["id"] = service.ID
23 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/cloudvideo/v1/video/detail`, data, options)
24 |
25 | return reBody
26 | }
27 |
--------------------------------------------------------------------------------
/service/video_group_list_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoGroupListService struct {
9 | }
10 |
11 | func (service *VideoGroupListService) VideoGroupList(c *gin.Context) map[string]interface{} {
12 |
13 | // 获得所有cookie
14 | cookies := c.Request.Cookies()
15 |
16 | options := &util.Options{
17 | Crypto: "weapi",
18 | Cookies: cookies,
19 | }
20 | data := make(map[string]string)
21 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/cloudvideo/group/list`, data, options)
22 |
23 | return reBody
24 | }
25 |
--------------------------------------------------------------------------------
/service/video_group_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoGroupService struct {
9 | GroupID string `json:"id" form:"id"`
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *VideoGroupService) VideoGroup(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | data["groupId"] = service.GroupID
24 | if service.Offset == "" {
25 | data["offset"] = "0"
26 | } else {
27 | data["offset"] = service.Offset
28 | }
29 | data["order"] = "true"
30 | data["need_preview_url"] = "true"
31 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/videotimeline/videogroup/otherclient/get`, data, options)
32 |
33 | return reBody
34 | }
35 |
--------------------------------------------------------------------------------
/service/video_sub_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoSubService struct {
9 | T string `json:"t" form:"t"`
10 | Id string `json:"id" form:"id"`
11 | }
12 |
13 | func (service *VideoSubService) VideoSub(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 |
24 | if service.T == "1" {
25 | service.T = "sub"
26 | } else {
27 | service.T = "unsub"
28 | }
29 |
30 | data["id"] = service.Id
31 |
32 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/cloudvideo/video/`+service.T, data, options)
33 |
34 | return reBody
35 | }
36 |
--------------------------------------------------------------------------------
/service/video_timeline_all__service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoTimelineAllService struct {
9 | Offset string `json:"offset" form:"offset"`
10 | }
11 |
12 | func (service *VideoTimelineAllService) VideoTimelineAll(c *gin.Context) map[string]interface{} {
13 |
14 | // 获得所有cookie
15 | cookies := c.Request.Cookies()
16 |
17 | options := &util.Options{
18 | Crypto: "weapi",
19 | Cookies: cookies,
20 | }
21 | data := make(map[string]string)
22 | data["groupId"] = "0"
23 | if service.Offset == "" {
24 | data["offset"] = "0"
25 | } else {
26 | data["offset"] = service.Offset
27 | }
28 | data["order"] = "true"
29 | data["need_preview_url"] = "true"
30 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/videotimeline/otherclient/get`, data, options)
31 |
32 | return reBody
33 | }
34 |
--------------------------------------------------------------------------------
/service/video_timeline_recommend_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "net/http"
6 | "singo/util"
7 | )
8 |
9 | type VideoTimelineRecommendService struct {
10 | Offset string `json:"offset" form:"offset"`
11 | }
12 |
13 | func (service *VideoTimelineRecommendService) VideoTimelineRecommend(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 | cookiesOS := &http.Cookie{Name: "os", Value: "pc"}
18 | cookies = append(cookies, cookiesOS)
19 |
20 | options := &util.Options{
21 | Crypto: "weapi",
22 | Cookies: cookies,
23 | }
24 | data := make(map[string]string)
25 | if service.Offset == "" {
26 | data["offset"] = "0"
27 | } else {
28 | data["offset"] = service.Offset
29 | }
30 | data["filterLives"] = "[]"
31 | data["withProgramInfo"] = "true"
32 | data["needUrl"] = "1"
33 | data["resolution"] = "480"
34 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/api/videotimeline/get`, data, options)
35 |
36 | return reBody
37 | }
38 |
--------------------------------------------------------------------------------
/service/video_url_service.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | "singo/util"
6 | )
7 |
8 | type VideoUrlService struct {
9 | ID string `json:"id" form:"id"`
10 | Res string `json:"resolution" form:"resolution"`
11 | }
12 |
13 | func (service *VideoUrlService) VideoUrl(c *gin.Context) map[string]interface{} {
14 |
15 | // 获得所有cookie
16 | cookies := c.Request.Cookies()
17 |
18 | options := &util.Options{
19 | Crypto: "weapi",
20 | Cookies: cookies,
21 | }
22 | data := make(map[string]string)
23 | if service.Res == "" {
24 | data["resolution"] = "1080"
25 | } else {
26 | data["resolution"] = service.Res
27 | }
28 | data["ids"] = `["` + service.ID + `"]`
29 | reBody, _ := util.CreateRequest("POST", `https://music.163.com/weapi/cloudvideo/playurl`, data, options)
30 |
31 | return reBody
32 | }
33 |
--------------------------------------------------------------------------------
/util/common.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | "math/rand"
5 | "time"
6 | )
7 |
8 | // RandStringRunes 返回随机字符串
9 | func RandStringRunes(n int) string {
10 | var letterRunes = []rune("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
11 |
12 | rand.Seed(time.Now().UnixNano())
13 | b := make([]rune, n)
14 | for i := range b {
15 | b[i] = letterRunes[rand.Intn(len(letterRunes))]
16 | }
17 | return string(b)
18 | }
19 |
--------------------------------------------------------------------------------