Coder Social home page Coder Social logo

solomonleon / netease-music-downloader Goto Github PK

View Code? Open in Web Editor NEW
58.0 2.0 4.0 26 KB

Download playlist and songs from netease muisc. 从网易云音乐上下载歌单和歌曲。

License: Mozilla Public License 2.0

Python 100.00%
netease-cloud-music mp3 flac-files downloader playlist

netease-music-downloader's Introduction

Logo

网易云 音乐下载器

Download playlist and songs from netease muisc. 从网易云音乐上下载歌单和歌曲。

Code with Python3.

这是什么?

这是一个易于使用的工具,可以从网易云音乐上下载歌单和歌曲。

它可以做到:

  • 一键添加播放列表

    main -a 播放列表id # 自动添加名字
    main -a 播放列表id 自定义名字 # 自定义名字
  • 全自动更新播放列表

    main -u # 更新所有播放列表
    main -u -da # 你可以把这行命令添加到定时任务中,它会自动更新播放列表并下载新歌曲。
  • 一键下载歌曲(有可能下载到高音质的flac文件,详见这里),flac自动转码为m4a

    main -da
  • 自动添加音频文件的歌曲信息(封面歌曲名作者专辑

    自动添加文件信息

  • 一键导出为iTunes的xml播放列表

    main -en 播放列表名字
  • 简单地删除已储存的播放列表

    main -rn 播放列表名字

更多功能,请移步至这里


此外,它还易于扩展,详情请移步至这里,欢迎提交PR。

代码已包含注释。

开始使用

你可以下载已打包好的程序。

  • Windows: 点击前往“发布页面

    下载最新的 nmd.zip 并解压后,使用以下命令查看帮助。

    main -h
  • macOS、Linux:

    点击此处下载源码zip压缩文件,下载完成后解压。

    请确保你已经安装了python3,使用以下命令安装依赖:

    python3 -m pip install -r requirements.txt

    使用以下命令查看帮助:

    python3 main.py -h

    本人暂时没有 macOS 或 Linux 设备,如果你愿意帮忙测试或打包,请联系我。

常见问题

  • 歌单无法获取:
    • requests报错:网络连接有问题
      • 解决方法:检查网络连接、暴打运营商
    • KeyError报错:触发网易云作弊检测机制
      • 解决方法:睡一觉后再试一次
  • 歌曲无法获取:
    • 检查代理,网易云会屏蔽国外IP。
  • 无法找到 user_agent_export.json
    • 在项目主页里下载 user_agent_export.json 并拷贝到程序目录。

获取源码

直接下载zip源码:

点击此处下载zip压缩文件

使用git克隆:

git clone https://github.com/SolomonLeon/netease-music-downloader.git

安装依赖:

pip install -r requirements.txt

参数及配置文件解释

参数

-a / --addPlaylist id name:
	添加播放列表:
		第一个参数是必选参数,为播放列表id,自动查重;
		第二个参数是可选参数,以自定义播放列表的名字。
		
-s / --songs:
	列出所有歌曲
	
-p / --playlists:
	列出所有的播放列表。
	
-da / --downloadAllSongs:
	下载所有的歌曲。
	--noTranscode:
		flac不转为m4a
		
-u / --update:
	从网易云音乐同步所有的播放列表。
	注意,此选项会也会同步删除操作。若想增量更新,请使用 -a 参数。
	
-rn / --removePlaylistByName name:
	通过名字移除播放列表。注意:若已自定义名字,请填写自定义后的名字。已储存的名字可通过 -p 获取。
	
-en / --exportXmlPlaylistByName name:
	通过名字导出iTunes的xml播放列表。注意:若已自定义名字,请填写自定义后的名字。

配置文件

#down_path: 下载路径,"Current_dir" 为当前路径
#max_thread: 最大线程数
#songfile_name: 歌曲文件命名,提供标签:{name}、{artist}、{album}、{playlist}、{nid}
#cover_size: 歌曲封面的长宽

[config]
down_path = Current_dir
max_thread = 30
songfile_name = {name} - {artist}
cover_size = 450

开发及贡献

开发

所有数据储存在 sqlite.db 内,数据库模型请移步到这里

使用驼峰命名法,首字母小写。exp: getSongsInfo

记得添加注释。

贡献

欢迎提交PR,我会把你的名字添加到“贡献者”栏目里。

你可以:

  • 添加新的解析方法

    请在这个函数中添加解析方法,别忘了在这里注册方法

    欢迎你把新方法分享给大家。

  • 修复漏洞、增加新功能

  • 提供新的网易云API

    请在这里提交你发现的API。我会把你的名字添加到“贡献者”栏目里。

贡献者

netease-music-downloader's People

Contributors

solomonleon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

netease-music-downloader's Issues

更新列表的时候报错

$ main.py -a playlist1 playlist2
...
$ main.py -rn playlist2
...
$ main.py -u # 删除某个歌单后执行更新
---------- Updating all playlists ----------
[*] Playlist name: 下载
 |  Removing deleted songs...
Traceback (most recent call last):
  File "main.py", line 394, in <module>
    updateAllPlaylist()
  File "main.py", line 325, in updateAllPlaylist
    removePlaylistInSongDB(delDataList)
TypeError: removePlaylistInSongDB() missing 1 required positional argument: 'dataList'

貌似少了个参数 playlist.name?

添加歌单时出错

win10 系统,从github下载了代码后,安装了所要的模块。运行时出现错误

λ python main.py -a 9646415
Traceback (most recent call last):
  File "main.py", line 392, in <module>
    addPlaylist(args.addPlaylist[0])
  File "main.py", line 24, in addPlaylist
    playlistResq = getPlaylist(playlistNid)
  File "D:\workspace\netease-music-downloader\api.py", line 16, in getPlaylist
    response = requests.request("GET", url, headers=headers).json()
  File "D:\anaconda3\lib\site-packages\requests\models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "D:\anaconda3\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "D:\anaconda3\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\anaconda3\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

看api.py 里那个接口地址好像返回不了东西。

-s指令部分似乎少了一句代码

showAllSongs() 函数没有给songs赋值就直接用了 导致-s指令似乎不能正常使用
我下载的是源码 不知道是不是上传时误删了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.