Skip to content

Commit

Permalink
Version 1.6.3.10
Browse files Browse the repository at this point in the history
cloud : fixes #12
  • Loading branch information
mos9527 committed Sep 5, 2021
1 parent 8ccde42 commit e7ed74c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyncm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from time import time
import requests,logging,json

__version__ = "1.6.3.9"
__version__ = "1.6.3.10"

class Session(requests.Session):
'''Represents an API session'''
Expand Down
9 changes: 5 additions & 4 deletions pyncm/apis/cloud.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'''我的音乐云盘 - Cloud APIs'''
import json
from . import WeapiCryptoRequest,LoginRequiredApi,EapiCryptoRequest,Crypto,GetCurrentSession
BUCKET = 'jd-musicrep-privatecloud-audio-public'

@WeapiCryptoRequest
@LoginRequiredApi
Expand Down Expand Up @@ -31,7 +32,7 @@ def GetCloudDriveItemInfo(song_ids:list):
return '/weapi/v1/cloud/get/byids',{'songIds':ids}

@EapiCryptoRequest
def GetNosToken(filename,md5,fileSize,ext,type='audio',nos_product=3,bucket='',local=False):
def GetNosToken(filename,md5,fileSize,ext,type='audio',nos_product=3,bucket=BUCKET,local=False):
'''移动端 - 云盘占位
Args:
Expand All @@ -41,7 +42,7 @@ def GetNosToken(filename,md5,fileSize,ext,type='audio',nos_product=3,bucket='',l
ext (str): 文件拓展名
type (str, optional): 上传类型. Defaults to 'audio'.
nos_product (int, optional): APP类型. Defaults to 3.
bucket (str, optional): 未知. Defaults to ''.
bucket (str, optional): 转存bucket. Defaults to 'jd-musicrep-privatecloud-audio-public'.
local (bool, optional): 未知. Defaults to False.
Returns:
Expand All @@ -50,7 +51,7 @@ def GetNosToken(filename,md5,fileSize,ext,type='audio',nos_product=3,bucket='',l
return '/eapi/nos/token/alloc',{"type":str(type),"nos_product":str(nos_product),"md5":str(md5),"local":str(local).lower(),"filename":str(filename),"fileSize":str(fileSize),"ext":str(ext),"bucket":str(bucket),"checkToken":Crypto.checkToken()}


def SetUploadObject(stream,md5,fileSize,objectKey,token,offset=0,compete=True):
def SetUploadObject(stream,md5,fileSize,objectKey,token,offset=0,compete=True,bucket=BUCKET):
'''移动端 - 上传内容
Args:
Expand All @@ -65,7 +66,7 @@ def SetUploadObject(stream,md5,fileSize,objectKey,token,offset=0,compete=True):
dict
'''
r = GetCurrentSession().post(
'http://45.127.129.8/ymusic/' + objectKey.replace('/','%2F'),
'http://45.127.129.8/%s/' % bucket + objectKey.replace('/','%2F'),
data=stream,
params={
'version':'1.0',
Expand Down

0 comments on commit e7ed74c

Please sign in to comment.