{"id":24783383,"url":"https://github.com/chaunsin/netease-cloud-music","last_synced_at":"2025-04-05T09:09:02.222Z","repository":{"id":215667229,"uuid":"739451727","full_name":"chaunsin/netease-cloud-music","owner":"chaunsin","description":"网易云音乐 Golang API 接口 + 命令行工具套件(签到 + 音乐合伙人 + 云盘 + 下载Hi-Res音质 + 刷歌等) + 一键完成任务","archived":false,"fork":false,"pushed_at":"2024-10-24T10:04:58.000Z","size":8084,"stargazers_count":149,"open_issues_count":1,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-25T06:52:29.714Z","etag":null,"topics":["go","golang","music","ncm","netease-cloud-music","reverse-engineering","sdk-go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chaunsin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-05T15:46:19.000Z","updated_at":"2024-10-24T10:04:40.000Z","dependencies_parsed_at":"2024-01-14T12:07:19.215Z","dependency_job_id":"d863bd45-59f7-4a80-a2b4-8b716d43064e","html_url":"https://github.com/chaunsin/netease-cloud-music","commit_stats":null,"previous_names":["chaunsin/netease-cloud-music"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaunsin%2Fnetease-cloud-music","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaunsin%2Fnetease-cloud-music/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaunsin%2Fnetease-cloud-music/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaunsin%2Fnetease-cloud-music/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chaunsin","download_url":"https://codeload.github.com/chaunsin/netease-cloud-music/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312082,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","music","ncm","netease-cloud-music","reverse-engineering","sdk-go"],"created_at":"2025-01-29T12:16:48.391Z","updated_at":"2025-04-05T09:09:02.173Z","avatar_url":"https://github.com/chaunsin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netease-cloud-music\n\n[![GoDoc](https://godoc.org/github.com/chaunsin/netease-cloud-music?status.svg)](https://godoc.org/github.com/chaunsin/netease-cloud-music) [![Go Report Card](https://goreportcard.com/badge/github.com/chaunsin/netease-cloud-music)](https://goreportcard.com/report/github.com/chaunsin/netease-cloud-music) [![ci](https://github.com/chaunsin/netease-cloud-music/actions/workflows/ci.yml/badge.svg)](https://github.com/chaunsin/netease-cloud-music/actions/workflows/ci.yml) [![deploy image](https://github.com/chaunsin/netease-cloud-music/actions/workflows/deploy_image.yml/badge.svg)](https://github.com/chaunsin/netease-cloud-music/actions/workflows/deploy_image.yml)\n\n网易云音乐 Golang API 接口 + 命令行工具套件 + 一键完成任务\n\n## ⚠️ 声明\n\n**本项目仅供个人学习使用,切勿用于商业用途、非法用途使用！！！**\n\n**使用此项目遇到封号等问题概不负责,使用前请谨慎考虑！！！**\n\n**如有侵权即删！！！**\n\n## ✨ 功能\n\n### 命令行 (ncmctl)\n\n- [x] 一键每日任务完成(音乐合伙人、云贝签到、刷歌300首)\n- [x] 云贝签到(连续签到奖励目前需要手动领取)\n- [x] “音乐合伙人”自动测评(5首基础歌曲 + 2到7首随机额外歌曲测评，另不包含\"歌曲推荐\"测评)\n  2025年3月[公告](https://music.163.com/#/event?id=30336457500\u0026uid=7872690377)、[规则详情](https://y.music.163.com/g/yida/9fecf6a378be49a7a109ae9befb1b8d3)\n- [x] 每日刷歌300首(带去重功能)\n- [x] 云盘上传(支持并行批量上传)\n- [x] 解密.ncm文件为.mp3/.flac可播放歌曲(支持并行批量解析)。\n- [x] `crypto`支持接口参数加解密便于调试\n- [x] `curl`子命令调用网易云音乐API,无需关心出入参数加解密问题便于调试\n    - [ ] 支持动态链接请求\n- [x] 音乐下载，支持标准、高品质、极高(HQ)、无损(SQ)、Hi-Res品质下载\n- [ ] vip每日签到\n- [ ] vip日常任务完成(待考虑)\n- [ ] “音乐人”任务自动完成(待考虑)\n- [ ] proxy 代理\n\n### api\n\n- weapi 网页端、小程序使用\n- eapi PC端、移动端使用\n\n目前由于本人时间精力有限,暂未书写文档,不过可以参考`api`目录下代码,代码通俗易懂,且有注释.\n\n**提示:**\n目前主要实现了weapi也推荐使用weapi,接口相对较全，如需要其他接口可提 [issue](https://github.com/chaunsin/netease-cloud-music/issues)。\n\n## 💻 要求\n\n- golang \u003e= 1.21\n- makefile (可选)\n- git (可选)\n- docker (可选)\n\n## ncmctl\n\n### 🔨 安装\n\n**可执行文件安装**\n\n```shell\ngo install github.com/chaunsin/netease-cloud-music/cmd/ncmctl@latest\n```\n\n或\n\n```shell\ngit clone https://github.com/chaunsin/netease-cloud-music.git\ncd netease-cloud-music \u0026\u0026 make install\n```\n\n**提示:** 默认会安装到`$GOPATH/bin`目录下\n\n**docker版本镜像获取方式**\n\n```shell\ndocker pull chaunsin/ncmctl:latest # dockerhub镜像仓库\ndocker pull ghcr.io/chaunsin/ncmctl:latest # github镜像仓库\n```\n\n镜像仓库以及docker使用方式: https://hub.docker.com/r/chaunsin/ncmctl\n\n如有条件自编译镜像\n\n```shell\ngit clone https://github.com/chaunsin/netease-cloud-music.git\ncd netease-cloud-music \u0026\u0026 make build-iamge\n```\n\n**提示:** 自行编译需要安装docker环境,另外受国服环境影响最好开梯子。\n\n**青龙脚本使用方式请参考:**\n\n[\u003e\u003e 点我 \u003c\u003c](docs/qinglong.md)\n\n### 🚀 使用\n\n**一、二维码登录**\n\n```shell\nncmctl login qrcode\n```\n\n**提示:** 使用手机登录网易云音乐app进行扫码授权登录，如果不能识别终端打印的二维码可根据终端输出得文件路径提示找到二维码图片进行扫描,或者copy终端输出得\n`qrcode content: https://www.163.com/xxx` 内容自己生成二维码再进行扫描(_粘贴时不要包含`qrcode content: `\n以及结尾空格_)。扫描有时效性,默认超时时间为5分钟,另外扫码过程中\n**不能退出终端**!!! 如有问题可重复此流程,为避免被风控不要频繁登录。\n\n在线生成二维码工具: https://www.bejson.com/convert/qrcode/#google_vignette\n\n**二、一键执行每日所有任务**\n\n```shell\nncmctl task\n```\n\n**提示:** 默认task包含\n\n- sign (签到)\n- partner (音乐合伙人)\n- scrobble (刷歌300首)\n\n如果只运行某一个任务,比如签到:\n\n```shell\nncmctl task --sign\n````\n\n另外`partner`\"音乐合伙人\"资格不是所有人都有，网易会不定期私信邀请一部分人成为音乐合伙人。由于`ncmctl task`\n默认是执行所有任务，因此没有该资格得人执行如下\n\n```shell\nncmctl task --sign --scrobble \n```\n\n如果想更改某一个任务默认运行时间,比如刷歌(scrobble)在每天晚上20:00:00点执行.\n\n```shell\nncmctl task --scrobble.cron \"0 20 * * *\"\n```\n\n提示:\n\n- 需要登录\n- 本命令会以服务得方式一直持续运行,如要退出,请使用`ctrl+c`退出。\n- `ncmctl` 采用标准的[crontab](https://zh.wikipedia.org/wiki/Cron)\n  表达式进行管理。crontab表达式编写工具[\u003e\u003e\u003e点我\u003c\u003c\u003c](https://crontab.guru/)\n\n**三、音乐下载**\n\n1. 下载Hi-Res品质音乐\n\n```shell\n# 指定歌曲分享链接\nncmctl download -l hires 'https://music.163.com/song?id=1820944399'\n# 指定歌曲id\nncmctl download -l hires '1820944399'\n```\n\n**提示:** url地址获取方式可以从分享中获取。如果知道歌曲id可以省略url地址，目前id仅支持歌曲id，不支持其他例如歌手、专辑、歌单id等。\n\n2. 下载无损品质(SQ)音乐,到当前`download`目录下\n\n```shell\nncmctl download -l SQ 'https://music.163.com/song?id=1820944399' -o ./download/ \n```\n\n**提示:** 支持得音质有(从低到高) `standard/128 \u003c higher/192 \u003c exhigh/HQ/320 \u003c lossless/SQ \u003c hires/HR` 参数可指定任意别名。\n\n3. 下载某一张专辑所有音乐,批量下载数量5(最大值20)\n\n```shell\nncmctl download -p 5 'https://music.163.com/#/album?id=34608111'\n```\n\n**提示:** 默认批量下载到当前`download`目录下面，音质为无损(SQ)\n\n4. 下载某一歌手的所有音乐\n\n```shell\nncmctl download --strict 'https://music.163.com/#/artist?id=33400892'\n```\n\n**提示:** `--strict`为严格默认,当歌曲没有对应品质的音乐时则会忽略下载,如果不指定`--strict`\n则默认下载次一级的音乐品质。比如指定HR品质没有对应得资源则下载SQ。\n\n5. 下载某一歌单\n\n```shell\n# web端链接\nncmctl download 'https://music.163.com/#/my/m/music/playlist?id=593617579'\n# pc端链接 \nncmctl download 'https://music.163.com/playlist?id=593617579'\n```\n\n**四、云盘上传**\n\n指定文件上传\n\n```shell\nncmctl cloud '/Users/chaunsin/Music/谁为我停留 - 田震.mp3' \n```\n\n指定目录上传(批量上传)\n\n```shell\nncmctl cloud '/Users/chaunsin/Music/' \n```\n\n**提示:** 默认批量上传数为3,最大为10,可指定`-p`参数设置,同时cloud支持按照自定义过滤条件进行上传详情可使用`-h`\n参考命令行。另外输入的目录深度不能超过3层。\n\n**五、.ncm文件解析**\n\n批量解析`/Users/chaunsin/Music/`目录输出到`./ncm`目录下\n\n```shell\nncmctl ncm '/Users/chaunsin/Music/' -o ./ncm\n```\n\n**提示:** 支持批量解析,默认参数为10，可以指定`-p`参数设置数量。同样输入的目录深度不能超过3层。\n\n**六、其他命令**\n\n```shell\n$ ncmctl --help\nncmctl is a toolbox for netease cloud music.\n\nUsage:\n  ncmctl [command]\n\nExamples:\n  ncmctl cloud\n  ncmctl crypto\n  ncmctl login\n  ncmctl curl\n  ncmctl partner\n\nAvailable Commands:\n  cloud       [need login] Used to upload music files to netease cloud disk\n  completion  Generate the autocompletion script for the specified shell\n  crypto      Crypto is a tool for encrypting and decrypting the http data\n  curl        Like curl invoke netease cloud music api\n  download    [need login] Download songs\n  help        Help about any command\n  login       Login netease cloud music\n  logout      Logout netease cloud music\n  ncm         Automatically parses .ncm to mp3/flac\n  partner     [need login] Executive music partner daily reviews\n  scrobble    [need login] Scrobble execute refresh 300 songs\n  sign        [need login] Sign perform daily cloud shell check-in and vip check-in\n  task        [need login] Daily tasks are executed asynchronously [partner、scrobble、sign]\n\nFlags:\n  -c, --config string   configuration file path\n      --debug           run in debug mode\n  -h, --help            help for ncmctl\n      --home string     configuration home path. the home path is used to store running information (default \"/Users/chaunsin\")\n  -v, --version         version for ncmctl\n\nUse \"ncmctl [command] --help\" for more information about a command.\n\n```\n\n**提示:** 内容以实际命令行为准\n\n## api\n\n参考如下\n\n- [登录](example%2Fexample_login_test.go)\n- [云盘上传](example%2Fexample_cloud_upload_test.go)(需要登录)\n- [音乐下载](example%2Fexample_download_test.go)(需要登录)\n\n## ❓ 已知问题\n\n### 1.下载无损音乐品质不准确\n\n当使用`ncmctl`下载无损音乐指定`-l lossless`时,会存在下载Hi-Res品质音乐情况,如果歌曲不支持Hi-Res品质音乐,同时有无损品质音乐则正常下载无损音乐,问题还需要排查。\n\n### 2.每日刷歌300首为啥达不到300首\n\n`scrobble`是支持去重功能的,会在`$HOME/.ncmctl/database/`记录听过哪些歌曲记录，但是目前没有找到这样的一个接口,判断当前账户听过哪些歌曲,因此这就会造成每日听歌达不到300首的情况。\n\n举个例子,在使用本程序之前,你听过某一首歌曲比如`反方向的钟 - 周杰伦`\n,由于此歌曲没有记录到数据库中,即视为未听过该歌曲造成了重复播放,进而导致不满足300首。\n\n综上所述强烈建议***不要清理`$HOME/.ncmctl/database/`目录下的文件数据***,除非你知道你在干什么。\n\n另外还有一种极端情况,刷歌采用的歌单是top榜单歌曲(top榜单歌曲相对来说都是新歌,不同得歌单更新频率不一样)\n，top榜单有50个左右，虽然看起来很多,但实际上还是存在不满足300首新歌情况,如果网易新歌曲更新得不及时,由于有判重复逻辑,因此还是会存在不满足300首得情况。\n\n### 3.ncmctl task和scrobble、sign、partner子命令有啥区别？\n\ntask命令是一个服务，默认执行是包含了scrobble、sign、partner子命令功能，启动之后会每天定时执行,如果把此命令部署到服务器上并配合\n`nohup`命令去启动就不用每天手动去执行一遍任务了。\n\n再说一下scrobble、sign、partner。这几个子命令不是服务，执行之后会立刻执行相应得任务并返回结果，不像task执行需要”到点了“才会执行。\n\n## ❤️ 鸣谢\n\n### 人员\n\n- [sjpqxuzdly03646](https://github.com/sjpqxuzdly03646) 对\"音乐合伙人\"功能得支持与帮助\n\n### 代码库\n\n- https://github.com/Binaryify/NeteaseCloudMusicApi\n- https://github.com/mos9527/pyncm\n- https://github.com/naruto2o2o/musicdump\n- https://crontab.guru\n\n以及本项目所依赖的三方优秀库。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaunsin%2Fnetease-cloud-music","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchaunsin%2Fnetease-cloud-music","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaunsin%2Fnetease-cloud-music/lists"}