Logo
Section 1 / 3

列出并筛选播放列表

学习并实践如何使用 Dailymotion Data API 检索播放列表以及筛选播放列表属性。

导入

列出并筛选播放列表

学习并实践如何使用 Dailymotion Data API 检索播放列表以及筛选播放列表属性。

// 在此处定义 API 密钥 const API_KEY = 'Bearer {{ACCESS_TOKEN}}';

// 在此处定义接口地址 const endpointUrl = 'https://api.dailymotion.com/playlists';

// 在此处定义请求头参数 const headerParameters = { authorization: API_KEY, "Content-Type": "application/json", };

// 设置 API 请求选项 const options = { method: "GET", headers: headerParameters, };

// 用于发起 API 请求的函数 async function fetchVideosList() { try { const response = await fetch(${endpointUrl}, options);

1// 输出响应结果 2printResponse(response);

} catch (error) { // 输出错误信息 printError(response); } }

// 调用函数以发起 API 请求 fetchVideosList();

字段类型分类描述
created_time日期可选该播放列表的创建时间。
description字符串可选该播放列表的描述信息。
id字符串可选播放列表的唯一标识 ID。
name字符串可选播放列表的名称。
owner用户可选播放列表的所有者。
private布尔值可选若播放列表为私有,则值为 true,否则为 false。
updated_time日期可选播放列表最后一次更新的时间。
videos_total整数可选播放列表中视频的总数。

// 在此处定义 API 密钥 const API_KEY = 'Bearer {{ACCESS_TOKEN}}';

// 在此处定义接口地址 const endpointUrl = 'https://api.dailymotion.com/playlist/{{PLAYLIST_ID}}';

// 在此处定义请求头参数 const headerParameters = { authorization: API_KEY, "Content-Type": "application/json", };

// 在此处定义查询参数 const queryParameters = new URLSearchParams({ fields: "owner,videos_total" });

// 设置 API 请求选项 const options = { method: "GET", headers: headerParameters, };

// 用于发起 API 请求的函数 async function fetchSpecificVideo() { try { const response = await fetch(${endpointUrl}?${queryParameters.toString()}, options);

1// 输出响应结果 2printResponse(response);

} catch (error) { // 输出错误信息 printError(response); } }

// 调用函数以发起 API 请求 fetchSpecificVideo();

视频

创建和编辑播放列表