Skip to content

Commit

Permalink
chore:update publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
2061360308 committed Dec 19, 2023
1 parent f34639a commit fb1d5fa
Show file tree
Hide file tree
Showing 14 changed files with 329 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.8
current_version = 0.1.7
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Build a binary wheel and a source tarball
run: |
cd package
python setup.py build
python setup.py upload
ls ./dist/
- name: Publish distribution 📦 to PyPI
Expand Down
39 changes: 39 additions & 0 deletions package/NeteaseCloudMusic.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Description-Content-Type: text/markdown
License-File: LICENSE



# NeteaseCloudMusic_PythonSDK
> 基于 [ NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 封装的 Python SDK。
> 网易云API Python版本。
Expand Down Expand Up @@ -54,15 +55,48 @@ print(api_list())

> 注意: request(self, name, query=None) 的第一个参数为API名称,第二个参数为API参数,具体API名称和参数请参考 [NeteaseCloudMusicApi文档](https://docs.neteasecloudmusicapi.binaryify.com),name支持`/song/url/v1`和`song_url_v1`两种写法。

> api已加入自动缓存,在测试接口时,如果频繁调用获取结果在query里应该加上timestamp参数来区分,例如
> ```python
> response = netease_cloud_music_api.request("song_url_v1", {"id": 33894312, "level": "exhigh", "timestamp": time.time()})
> ```

### 开发
- 克隆项目 `git clone git@github.com:2061360308/NeteaseCloudMusic_PythonSDK.git`
- 安装依赖 `pip install -r requirements.txt`
- 目录/文件说明
```
├── package 项目包根目录
├── test_gender 生成测试代码的脚本
├── test.py 手动测试/ 使用示例
```

### 更新
项目使用towncrier自动生成更新日志

在 newsfragments 目录下,创建一个新的文本文件。这个文件的名字应该是一个唯一的编号,后缀是 .rst。
例如,如果你正在处理编号为 123 的问题,你可以创建一个名为 123.feature.rst 的文件。

注意在 towncrier 中,新闻片段的类型通常由文件名的后缀决定。以下是一些常见的新闻片段类型:
- .feature: 用于描述新的特性或者功能。
- .bugfix: 用于描述一个 bug 修复。
- .doc: 用于描述文档的更改。
- .removal: 用于描述移除的特性或者功能。
- .misc: 用于描述其他类型的更改。
-
在这个文件中,写下你的更改的描述。这个描述应该是简短的,通常只有一到两句话。
例如`Added support for the XYZ feature.`

### 发布新版本
使用bumpversion自动更新版本号,提交并发布标签
你需要安装bumpversion然后执行
```bash
bumpversion patch # for a patch level increase (e.g., 1.0.0 to 1.0.1)
bumpversion minor # for a minor level increase (e.g., 1.0.0 to 1.1.0)
bumpversion major # for a major level increase (e.g., 1.0.0 to 2.0.0)
```

接下来会自动更新版本号并提交到远程仓库,然后发布一个新的标签
workflow会依据标签自动发布相应资源并且发布到pypi

### 改进
> 下列API未支持
Expand Down Expand Up @@ -107,3 +141,8 @@ print(api_list())
- /fm_trash

### 欢迎提交PR

更正request库返回多个cookie时自动用分号拼接导致后续cookie不好解析的问题
添加了对cookie中Max-Age为0的处理
改进判断cookie是否过期的逻辑
添加了自动处理cookie的更新操作
1 change: 1 addition & 0 deletions package/NeteaseCloudMusic.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ NeteaseCloudMusic/__init__.py
NeteaseCloudMusic/config.json
NeteaseCloudMusic/help.py
NeteaseCloudMusic/main.py
NeteaseCloudMusic/utils.py
NeteaseCloudMusic.egg-info/PKG-INFO
NeteaseCloudMusic.egg-info/SOURCES.txt
NeteaseCloudMusic.egg-info/dependency_links.txt
Expand Down
1 change: 1 addition & 0 deletions package/NeteaseCloudMusic.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
py_mini_racer
requests
diskcache
2 changes: 1 addition & 1 deletion package/NeteaseCloudMusic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .help import api_help, api_list
from .utils import format_cookie_str, prase_cookie_str

__version__ = '0.1.8'
__version__ = '0.1.7'
38 changes: 38 additions & 0 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,48 @@ print(api_list())

> 注意: request(self, name, query=None) 的第一个参数为API名称,第二个参数为API参数,具体API名称和参数请参考 [NeteaseCloudMusicApi文档](https://docs.neteasecloudmusicapi.binaryify.com),name支持`/song/url/v1``song_url_v1`两种写法。
> api已加入自动缓存,在测试接口时,如果频繁调用获取结果在query里应该加上timestamp参数来区分,例如
> ```python
> response = netease_cloud_music_api.request("song_url_v1", {"id": 33894312, "level": "exhigh", "timestamp": time.time()})
> ```
### 开发
- 克隆项目 `git clone git@github.com:2061360308/NeteaseCloudMusic_PythonSDK.git`
- 安装依赖 `pip install -r requirements.txt`
- 目录/文件说明
```
├── package 项目包根目录
├── test_gender 生成测试代码的脚本
├── test.py 手动测试/ 使用示例
```

### 更新
项目使用towncrier自动生成更新日志

在 newsfragments 目录下,创建一个新的文本文件。这个文件的名字应该是一个唯一的编号,后缀是 .rst。
例如,如果你正在处理编号为 123 的问题,你可以创建一个名为 123.feature.rst 的文件。

注意在 towncrier 中,新闻片段的类型通常由文件名的后缀决定。以下是一些常见的新闻片段类型:
- .feature: 用于描述新的特性或者功能。
- .bugfix: 用于描述一个 bug 修复。
- .doc: 用于描述文档的更改。
- .removal: 用于描述移除的特性或者功能。
- .misc: 用于描述其他类型的更改。
-
在这个文件中,写下你的更改的描述。这个描述应该是简短的,通常只有一到两句话。
例如`Added support for the XYZ feature.`

### 发布新版本
使用bumpversion自动更新版本号,提交并发布标签
你需要安装bumpversion然后执行
```bash
bumpversion patch # for a patch level increase (e.g., 1.0.0 to 1.0.1)
bumpversion minor # for a minor level increase (e.g., 1.0.0 to 1.1.0)
bumpversion major # for a major level increase (e.g., 1.0.0 to 2.0.0)
```

接下来会自动更新版本号并提交到远程仓库,然后发布一个新的标签
workflow会依据标签自动发布相应资源并且发布到pypi

### 改进
> 下列API未支持
Expand Down Expand Up @@ -88,3 +121,8 @@ print(api_list())
- /fm_trash

### 欢迎提交PR

更正request库返回多个cookie时自动用分号拼接导致后续cookie不好解析的问题
添加了对cookie中Max-Age为0的处理
改进判断cookie是否过期的逻辑
添加了自动处理cookie的更新操作
50 changes: 32 additions & 18 deletions package/build/lib/NeteaseCloudMusic/NeteaseCloudMusicApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if (typeof window === "undefined") {
}

function encodeURIComponent(str) {
str = String(str); // 将输入转换为字符串 以免True,False等非字符无法转换
var result = "";

if (str !== undefined && str !== null) {
Expand Down Expand Up @@ -37928,7 +37929,7 @@ const hug_comment_resourceTypeMap = config_namespaceObject.A;
});

;// CONCATENATED MODULE: ./package.json
const package_namespaceObject = {"i8":"0.1.1"};
const package_namespaceObject = {"i8":"0.1.2"};
;// CONCATENATED MODULE: ./module/inner_version.js

/* harmony default export */ const inner_version = ((query, request) => {
Expand Down Expand Up @@ -38338,30 +38339,19 @@ var crypto_js = __webpack_require__(1292);
;// CONCATENATED MODULE: ./module/login_refresh.js
// 登录刷新

/* harmony default export */ const login_refresh = (async (query, request) => {
let result = await request(
'POST',
/* harmony default export */ const login_refresh = ((query, request) => {
return request(
"POST",
`https://music.163.com/weapi/login/token/refresh`,
{},
{
crypto: 'weapi',
ua: 'pc',
crypto: "weapi",
ua: "pc",
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
if (result.body.code === 200) {
result = {
status: 200,
body: {
...result.body,
cookie: result.cookie.join(';'),
},
cookie: result.cookie,
}
}
return result
);
});

;// CONCATENATED MODULE: ./module/login_status.js
Expand Down Expand Up @@ -42852,6 +42842,7 @@ const weapi = (object) => {
for (let i = 0; i < 16; i++) {
secretKey += base62.charAt(Math.round(Math.random() * 61))
}

return {
params: aesEncrypt(
aesEncrypt(text, 'cbc', presetKey, iv),
Expand Down Expand Up @@ -43181,6 +43172,27 @@ function beforeRequest(name, query) {
return response;
});

;// CONCATENATED MODULE: ./afterRequest/login_refresh.js
/* harmony default export */ const afterRequest_login_refresh = ((response) => {
response = JSON.parse(response);
let cookie = response.cookie;
if (Array.isArray(cookie)) {
cookie = cookie.join(";");
}
if (response.body.code === 200) {
response = {
status: 200,
body: {
...response.body,
cookie: cookie,
},
cookie: cookie,
};
}

return response;
});

;// CONCATENATED MODULE: ./afterRequest/login_status.js
/* harmony default export */ const afterRequest_login_status = ((response) => {
response = JSON.parse(response);
Expand Down Expand Up @@ -43255,9 +43267,11 @@ function beforeRequest(name, query) {




/* harmony default export */ const afterRequestApi = ({
'check_music':afterRequest_check_music,
'login_cellphone':afterRequest_login_cellphone,
'login_refresh':afterRequest_login_refresh,
'login_status':afterRequest_login_status,
'related_playlist':afterRequest_related_playlist,
'top_playlist':afterRequest_top_playlist,
Expand Down
3 changes: 3 additions & 0 deletions package/build/lib/NeteaseCloudMusic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from .main import NeteaseCloudMusicApi
from .help import api_help, api_list
from .utils import format_cookie_str, prase_cookie_str

__version__ = '0.1.7'
Loading

0 comments on commit fb1d5fa

Please sign in to comment.