网易云weapi解码和封装。
Project description
from http.client import responses
netease_encode_api
网易云weapi解码和封装。
安装
- 请下载带有 pip 包安装器的 Python, 并将 Python 添加到 PATH。
- 打开命令行输入
pip install netease_encode_api - 在 Python 代码内引用:
from netease_encode_api import EncodeSession
使用
在 1.2.0+ 版本, EncodeSession 类已经成为了 requests.Session 的子类。
在不需要解码时, 请按照 request.Session 的使用方式正常使用。
在需要解码时, 请使用 EncodeSession.encoded_post(url, data)。
预留了 EncodeSession.cmd_login(), 受不可抗力控制 (网易云好像最近抓第三方蛮狠的), 暂未实现, 请耐心等待。在此之前, 请先用 Cookies 填写的方式, 写入 MUSIC_U 字段登录。具体方式如下:
- 在网页版登录网易云音乐;
- 打开浏览器开发者工具, 切换到
Application (应用程序)标签页; - 找到
Cookies一栏, 找到MUSIC_U字段, 复制其值; - 在 Python 代码内, 调用
EncodeSession.set_cookie("MUSIC_U", "复制的值")方法, 即可登录。
示例
from netease_encode_api import EncodeSession
es = EncodeSession()
# 加密获取歌曲下载链接
url = "https://music.163.com/weapi/song/enhance/player/url/v1"
data = {"ids":"[1462389992]",
"level":"exhigh",
"encodeType":"mp3"}
responses = es.encoded_post(url, data)
download_url = responses["data"][0]["url"]
download_responses = es.get(download_url)
with open(test.mp3, "wb") as f: f.write(download_responses.content)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netease_encode_api-1.2.3.tar.gz.
File metadata
- Download URL: netease_encode_api-1.2.3.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5bbc89a6607c0d1c5a568161ec93b3ed3b30f50c5ab8101b2c1f0c8e567ef9f
|
|
| MD5 |
457f24a10450909c2a5db2ececec34b6
|
|
| BLAKE2b-256 |
1a8d522b2b33980c4d8ff9eb32703efb97c09f7a72db89b0d7ef97e4fd29e9f8
|
Provenance
The following attestation bundles were made for netease_encode_api-1.2.3.tar.gz:
Publisher:
publish.yml on Cooooldwind/netease_encode_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netease_encode_api-1.2.3.tar.gz -
Subject digest:
e5bbc89a6607c0d1c5a568161ec93b3ed3b30f50c5ab8101b2c1f0c8e567ef9f - Sigstore transparency entry: 589546059
- Sigstore integration time:
-
Permalink:
Cooooldwind/netease_encode_api@7f9bf6198c938ba54cfd1bd4b99994e8ea123f84 -
Branch / Tag:
refs/tags/1.2.3 - Owner: https://github.com/Cooooldwind
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f9bf6198c938ba54cfd1bd4b99994e8ea123f84 -
Trigger Event:
push
-
Statement type:
File details
Details for the file netease_encode_api-1.2.3-py3-none-any.whl.
File metadata
- Download URL: netease_encode_api-1.2.3-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a644da78bfb659fdabe2d28d61ab44ccf1b5eef1004b492fa584ea4a3affd8a6
|
|
| MD5 |
3bf66074f75cc55b2d9fe1c01a0125f4
|
|
| BLAKE2b-256 |
925ada536b20208062fc3d3e9a3b7d275e82c7174ef87fddc304ff97a83a2733
|
Provenance
The following attestation bundles were made for netease_encode_api-1.2.3-py3-none-any.whl:
Publisher:
publish.yml on Cooooldwind/netease_encode_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netease_encode_api-1.2.3-py3-none-any.whl -
Subject digest:
a644da78bfb659fdabe2d28d61ab44ccf1b5eef1004b492fa584ea4a3affd8a6 - Sigstore transparency entry: 589546102
- Sigstore integration time:
-
Permalink:
Cooooldwind/netease_encode_api@7f9bf6198c938ba54cfd1bd4b99994e8ea123f84 -
Branch / Tag:
refs/tags/1.2.3 - Owner: https://github.com/Cooooldwind
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f9bf6198c938ba54cfd1bd4b99994e8ea123f84 -
Trigger Event:
push
-
Statement type: