V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
codezjx
V2EX  ›  分享创造

基于 Python3 的网易云音乐下载器(支持嵌入专辑封面等 ID3-Tags 信息)

  •  
  •   codezjx ·
    codezjx · 2017-08-08 23:17:33 +08:00 · 4503 次点击
    这是一个创建于 2662 天前的主题,其中的信息可能已经有所发展或是发生改变。

    前阵子开源了个下载器,可以免费下载网易云的付费音乐并嵌入专辑封面,用了一阵子暂时没发现什么问题,特地分享给大家。

    简单介绍:

    基于 Python3 编写的网易云音乐命令行下载器,自动下载专辑封面,记录歌手名、音乐标题、专辑名等元数据,并写入 ID3 Tags metadata 容器。在 GitHub 上试了几个高星的下载器都没有写入专辑封面,对于强迫症患者简直不能忍,于是一怒之下决定自己写,欢迎各位支持。

    地址:

    https://github.com/codezjx/netease-cloud-music-dl

    12 条回复    2017-08-10 22:12:19 +08:00
    sobigfish
        1
    sobigfish  
       2017-08-08 23:35:01 +08:00
    当心 dmca.... 猪厂法务部属于跑得快的那种
    KiseXu
        2
    KiseXu  
       2017-08-09 00:46:38 +08:00 via iPhone
    免费歌曲本来就可以下载,付费歌曲买个会员也不贵,你喜欢的项目到最后赚不到钱,最后受害的不还是自己么。
    codezjx
        3
    codezjx  
    OP
       2017-08-09 09:58:52 +08:00
    @KiseXu 网易云上面很多音乐都下架了,开个会员一点意义都没有,我之前就是开了一阵子的会员到头来还是得去虾米或者 QQ 音乐下。
    codezjx
        4
    codezjx  
    OP
       2017-08-09 09:59:41 +08:00
    @sobigfish GitHub 上有好多个下载器,都还坚挺着,淡定淡定。。。
    sobigfish
        5
    sobigfish  
       2017-08-09 10:15:56 +08:00
    @codezjx #4 我很淡定 只是提个醒,免得 repo list 里多个删不掉的被屏蔽的 repo (搜了下貌似是有不少,说明没以前那么夸张了?)
    inmyfree
        6
    inmyfree  
       2017-08-09 10:32:07 +08:00
    应该添加代理或者间隔时间的。。。。

    ncm -p 27382776

    Traceback (most recent call last):
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
    File "<string>", line 2, in raise_from
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
    File "/usr/lib/python3.4/http/client.py", line 1208, in getresponse
    response.begin()
    File "/usr/lib/python3.4/http/client.py", line 380, in begin
    version, status, reason = self._read_status()
    File "/usr/lib/python3.4/http/client.py", line 342, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
    File "/usr/lib/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
    ConnectionResetError: [Errno 104] Connection reset by peer

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/usr/local/lib/python3.4/dist-packages/requests-2.18.3-py3.4.egg/requests/adapters.py", line 440, in send
    timeout=timeout
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/util/retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
    File "<string>", line 2, in raise_from
    File "/usr/local/lib/python3.4/dist-packages/urllib3-1.22-py3.4.egg/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
    File "/usr/lib/python3.4/http/client.py", line 1208, in getresponse
    response.begin()
    File "/usr/lib/python3.4/http/client.py", line 380, in begin
    version, status, reason = self._read_status()
    File "/usr/lib/python3.4/http/client.py", line 342, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
    File "/usr/lib/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
    urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/usr/local/bin/ncm", line 9, in <module>
    load_entry_point('netease-cloud-music-dl==0.2.0', 'console_scripts', 'ncm')()
    File "/usr/local/lib/python3.4/dist-packages/netease_cloud_music_dl-0.2.0-py3.4.egg/ncm/start.py", line 75, in main
    File "/usr/local/lib/python3.4/dist-packages/netease_cloud_music_dl-0.2.0-py3.4.egg/ncm/start.py", line 41, in download_playlist_songs
    File "/usr/local/lib/python3.4/dist-packages/netease_cloud_music_dl-0.2.0-py3.4.egg/ncm/downloader.py", line 59, in download_song_by_song
    File "/usr/local/lib/python3.4/dist-packages/netease_cloud_music_dl-0.2.0-py3.4.egg/ncm/downloader.py", line 76, in download_file
    File "/usr/local/lib/python3.4/dist-packages/requests-2.18.3-py3.4.egg/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
    File "/usr/local/lib/python3.4/dist-packages/requests-2.18.3-py3.4.egg/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
    File "/usr/local/lib/python3.4/dist-packages/requests-2.18.3-py3.4.egg/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
    File "/usr/local/lib/python3.4/dist-packages/requests-2.18.3-py3.4.egg/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
    File "/usr/local/lib/python3.4/dist-packages/requests-2.18.3-py3.4.egg/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
    requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
    codezjx
        7
    codezjx  
    OP
       2017-08-09 13:18:32 +08:00
    @inmyfree 我之前是网络不稳定的时候会出现这个,偶发的,你隔一会再试试看,我这边是可以下载的。
    codezjx
        8
    codezjx  
    OP
       2017-08-09 14:05:33 +08:00
    @sobigfish 猪厂的法务估计已经放弃抵抗了,网上的破解教程实在是太多,防不胜防。他们的程序猿小哥快点把漏洞给填了才是硬道理。
    sunnyzhi
        9
    sunnyzhi  
       2017-08-10 11:04:05 +08:00
    我最近也在研究如何抓取 MOOV (一个香港的音乐 app )音乐文件,低码流的 acc 格式用的是 m3u8 的 hls 方式,这个没什么难度很容易搞定。但是无损版本的 acc 文件,不知道解密的细节以及不知如何取得 key。
    网易云是否需要反编译 app 才找到相关解密的方法呢?能否大致讲讲工作的流程,路线?
    623902748
        10
    623902748  
       2017-08-10 11:37:42 +08:00
    可不可以把歌词也嵌到 ID3-Tags 中?
    codezjx
        11
    codezjx  
    OP
       2017-08-10 21:50:02 +08:00
    @sunnyzhi 网易云的破解烂大街了,github 上随便搜一大堆,我是参考 github 是的这个项目: https://github.com/darknessomi/musicbox
    之前看文章是说通过 2 次 AES 对称加密了内容,然后秘钥和加密过程写在 js 里面了,所以很容易被破了。
    codezjx
        12
    codezjx  
    OP
       2017-08-10 22:12:19 +08:00
    @623902748 有相关的 api 可以获取到歌词,http://music.163.com/api/song/lyric?id=123123&lv=1。
    讲道理,嵌入歌词也是没问题的,可以上去给我提个 issue,我有空试下。
    对了,异步歌词和同步歌词有啥区别? ID3 里面有这两种。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5840 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 02:01 · PVG 10:01 · LAX 18:01 · JFK 21:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.