全部产品
媒体转码

查询媒体-使用OSS文件地址

更新时间:2017-07-13 11:56:49   分享:   

用户在不知道媒体ID的情况下(直播走工作流转点播),可以通过媒体的输入地址进行媒体信息的查询,接口为 QueryMediaListByURL

  1. import json
  2. from aliyunsdkmts.request.v20140618 import QueryMediaListByURLRequest
  3. from aliyunsdkcore import client
  4. import urllib
  5. region = '<region>'
  6. access_key_id = '<accessKeyId>'
  7. access_key_secret = '<accessKeySecret>'
  8. def queryMediaListByURL():
  9. global client
  10. client = client.AcsClient(access_key_id, access_key_secret, region)
  11. request = QueryMediaListByURLRequest.QueryMediaListByURLRequest()
  12. ossDomain = 'http://<input-bucket>.<region>.aliyuncs.com/';
  13. #对ossObject进行encode
  14. ossObject = encodeByRFC3986("test/笑傲江湖.mp4")
  15. request.set_FileURLs(ossDomain + ossObject)
  16. response = client.do_action_with_exception(request);
  17. json_response = json.loads(response)
  18. print json_response
  19. def encodeByRFC3986(ossObject):
  20. return urllib.quote(ossObject)
  21. if __name__ == "__main__":
  22. queryMediaListByURL()
本文导读目录
本文导读目录
以上内容是否对您有帮助?