Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

29 linhas
1.3KB

  1. import json
  2. import traceback
  3. from aliyunsdkcore.client import AcsClient
  4. from aliyunsdkvod.request.v20170321 import CreateUploadVideoRequest
  5. from aliyunsdkvod.request.v20170321 import GetPlayInfoRequest
  6. from voduploadsdk.AliyunVodUtils import *
  7. from voduploadsdk.AliyunVodUploader import AliyunVodUploader
  8. from voduploadsdk.UploadVideoRequest import UploadVideoRequest
  9. # 获取播放地址
  10. def init_vod_client(accessKeyId, accessKeySecret):
  11. regionId = 'cn-shanghai' # 点播服务接入地域
  12. connectTimeout = 3 # 连接超时,单位为秒
  13. return AcsClient(accessKeyId, accessKeySecret, regionId, auto_retry=True, max_retry_time=3, timeout=connectTimeout)
  14. def get_play_info(clt, videoId):
  15. request = GetPlayInfoRequest.GetPlayInfoRequest()
  16. request.set_accept_format('JSON')
  17. request.set_VideoId(videoId)
  18. request.set_AuthTimeout(3600*5)
  19. response = json.loads(clt.do_action_with_exception(request))
  20. return response
  21. try:
  22. clt = init_vod_client('LTAI5tSJ62TLMUb4SZuf285A', 'MWYynm30filZ7x0HqSHlU3pdLVNeI7')
  23. playInfo = get_play_info(clt, "f2bd66de44f742a5bb7d603c295dc47f")
  24. print(json.dumps(playInfo, ensure_ascii=False, indent=4))
  25. except Exception as e:
  26. print(str(e))
  27. print("403" in str(e))
  28. # print(traceback.format_exc())