All Products
Search
Document Center

ApsaraVideo VOD:Live to VOD

Last Updated:Aug 22, 2023

This topic provides examples on how to use the API operations of the live-to-VOD module. The API operations are encapsulated in ApsaraVideo VOD SDK for Python. You can call the API operations to query live-to-VOD videos.

Initialize a client

Before you use the SDK, initialize a client. For more information, see Initialization.

Query live-to-VOD videos

You can call the ListLiveRecordVideo operation to query live-to-VOD videos.

For more information about the request and response parameters of this operation, see ListLiveRecordVideo. Sample code:

from aliyunsdkvod.request.v20170321 import ListLiveRecordVideoRequest
def list_live_record_video(clt):
    request = ListLiveRecordVideoRequest.ListLiveRecordVideoRequest()
    request.set_StartTime("2018-04-24T03:21:04Z")
    request.set_EndTime("2018-05-21T03:21:44Z")
    request.set_StreamName("testStream****")
    request.set_DomainName("example.aliyundoc.com")
    request.set_AppName("testApp****")

    request.set_accept_format('JSON')
    response = json.loads(clt.do_action_with_exception(request))
    return response

try:
    videoList = list_live_record_video(clt)
    print(json.dumps(videoList, ensure_ascii=False, indent=4))

except Exception as e:
    print(e)
    print(traceback.format_exc())