Skip to main content

网易云weapi解码和封装。

Project description

from http.client import responses

netease_encode_api

网易云weapi解码和封装。

安装

  1. 请下载带有 pip 包安装器的 Python, 并将 Python 添加到 PATH。
  2. 打开命令行输入 pip install netease_encode_api
  3. 在 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 字段登录。具体方式如下:

  1. 在网页版登录网易云音乐;
  2. 打开浏览器开发者工具, 切换到 Application (应用程序) 标签页;
  3. 找到 Cookies 一栏, 找到 MUSIC_U 字段, 复制其值;
  4. 在 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netease_encode_api-1.2.3.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netease_encode_api-1.2.3-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

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

Hashes for netease_encode_api-1.2.3.tar.gz
Algorithm Hash digest
SHA256 e5bbc89a6607c0d1c5a568161ec93b3ed3b30f50c5ab8101b2c1f0c8e567ef9f
MD5 457f24a10450909c2a5db2ececec34b6
BLAKE2b-256 1a8d522b2b33980c4d8ff9eb32703efb97c09f7a72db89b0d7ef97e4fd29e9f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for netease_encode_api-1.2.3.tar.gz:

Publisher: publish.yml on Cooooldwind/netease_encode_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netease_encode_api-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for netease_encode_api-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a644da78bfb659fdabe2d28d61ab44ccf1b5eef1004b492fa584ea4a3affd8a6
MD5 3bf66074f75cc55b2d9fe1c01a0125f4
BLAKE2b-256 925ada536b20208062fc3d3e9a3b7d275e82c7174ef87fddc304ff97a83a2733

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page