All Products
Search
Document Center

:Preheating M3U8 resources with script refresh in Alibaba Cloud Content Delivery Network and ApsaraVideo VOD

Last Updated:Apr 07, 2022

Overview

This paper mainly introduces the operation method of refreshing and preheating M3U8 resources through script programs when using Alibaba Cloud Content Delivery Network and ApsaraVideo VOD. This script program can implement the following scenarios:

  • Refresh and preload resources for URLs.
  • Flushes and preloads the TS file of the M3U8 resource.
  • Batch refresh and preload URLs by using local files.
  • Perform directory refresh on the URL.

Note: The default Alibaba Cloud Content Delivery Network and ApsaraVideo VOD for refresh limit is 2000 per day, and the default warm-up limit is 500 per day.

Details

The following are the preparations, command details and common errors for refreshing and preheating M3U8 resources through script programs.

Preparations

The following are preparations:

  • The script program is implemented in Java. We recommend that you use JDK 1.7 or later.
  • Download the jar script and use it directly.
  • The JAR directory must contain log files to store running logs.
  • Download and decompress the project source code Maven.

Command Details

Terms

The format of the jar script is as follows, where [$Parameter] is the parameter that you need to use.

java -jar refreshPush.jar [$Parameter]

The following is a detailed description of some jar script commands:

  • -- help: the help description of the jar script command.
  • -- product: The value of the supported product category is Alibaba Cloud Content Delivery Network or vod. This parameter is required.
  • -- accessKeyId: the AccessKeyId information of the user. This parameter is required.
  • -- accessKeySecret: the AccessKeySecrest information of the user. This parameter is required.
  • -- source: the source to be refreshed or preloaded. You can specify the URL or file path. This parameter is required.
  • -- type: Enter url or dir, which means that the URL is refreshed or preloaded. If the URL is refreshed, enter dir.
  • -- action: Enter push or refresh, which indicates preheating or refreshing. Default value: refresh.
  • -- ts: Enter true or false. true indicates that the TS file of the M3U8 resource is refreshed and preloaded. Default value: false.

Refresh URL resources

To refresh URL resources, refer to the following command.

java -jar refreshPush.jar --product=[$Product] --accessKeyId=[$AccesskeyId] --accessKeySecret=[$AccessKeySecret] --source=[$URL]

Note:

  • [$Product]: You can enter a Alibaba Cloud Content Delivery Network or vod, which represents a Alibaba Cloud Content Delivery Network product or a ApsaraVideo VOD product.
  • [$AccesskeyId]: your AccesskeyId.
  • [$AccessKeySecret]: Your AccessKeySecret.
  • [$URL]: URL resources to be refreshed, such as https://example.com/shj/RTC/AliRTC-1.12-WebSample/index.html.

Refresh the URL directory

To refresh the URL directory, refer to the following command.

Note: The URL must start with https or http and end with /, for example, https://example.com/shj/RTC/AliRTC-1.12-WebSample/.

java -jar refreshPush.jar --product=[$Product] --accessKeyId=[$AccesskeyId] --accessKeySecret=[$AccessKeySecret] --source=[$URL] --type=dir --action=refresh

Preheating URL resources

To preload URL resources, refer to the following command.

Note: When you use Alibaba Cloud Content Delivery Network, you can only preload URL resources. You cannot preload URL directories.

java -jar refreshPush.jar --product=[$Product] --accessKeyId=[$AccesskeyId] --accessKeySecret=[$AccessKeySecret] --source=[$URL] --type=url --action=push

Batch refresh and preload URLs

To perform batch refresh of URLs by using local files, refer to the following command.

java -jar refreshPush.jar --product=[$Product] --accessKeyId=[$AccesskeyId] --accessKeySecret=[$AccessKeySecret] --source=[$File] --action=[$Action] --type=url

Note:

  • [$File]: a local file. The text contains multiple URLs. Each URL is separated by a line break.
  • [$Action]: Enter refresh as the refresh operation and push as the warm-up operation. If you do not specify this parameter, the refresh operation is performed by default.

Flush and preload TS files for M3U8 resources

For more information about how to refresh and warm up the TS file of the M3U8 resource, refer to the following command.

java -jar refreshPush.jar --product=[$Product] --accessKeyId=[$AccesskeyId] --accessKeySecret=[$AccessKeySecret] --source=[$M3U8_URL] --action=[$Action] --ts=true

Note :[$M3U8_URL] is the URL of the M3U8 resource.

Common errors and troubleshooting

Error message Error content
Specified access key is not found The AccessKey used is incorrect.

params error,please check or use --help

The parameter used in the command is incorrect. Use the -- help parameter to view the command instructions.

Specified Access Key Secret is not valid

The AccessKeySecret used is wrong.

url is not start with https or  http

The URL does not start with https or https.

url is not start with https or http,end with /

The URL in the directory must start with https or https and end with "/"
Your preload attempts have exceeded the daily limit Preheating reached the upper limit
Your refresh attempts have exceeded the daily limit Refresh reached the upper limit

Applicable scope

  • CDN
  • ApsaraVideo VOD (VOD)