📅  最后修改于: 2023-12-03 14:48:18.964000             🧑  作者: Mango
Vevo API 是 Vevo 开放平台提供的 API 接口,可以让开发者实现对 Vevo 音乐视频服务的增量更新、搜索、推荐和播放等功能。使用 Vevo API 可以轻松地集成 Vevo 音乐视频服务到你的应用程序中。
使用 Vevo API 之前需要获得 Vevo 开放平台的 API key。获取方式请参考 Vevo 官网的说明。
Vevo API 提供了以下几个接口:
使用 Vevo API 可以实现通过关键词进行音乐视频搜索。示例代码如下:
curl -X GET \
'https://apiv2.vevo.com/search?q=sia' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Vevo-App-Id: {your_app_id}' \
-H 'Vevo-Device-Id: {your_device_id}'
返回结果示例:
{
"meta": {
"pageNumber": 1,
"pageSize": 20,
"totalCount": 2
},
"results": [
{
"id": "USUV71602639",
"title": "Sia - The Greatest",
"artists": [
{
"id": "USUV71300188",
"name": "Sia"
}
],
"thumbnails": [
{
"url": "https://pmimages.blob.core.windows.net/thumbs/NO_JPEG_VERTICAL_CROPPED_LARGE/USUV71602639.jpg"
}
],
"url": "https://www.vevo.com/watch/sia/the-greatest-(official-video)/USUV71602639",
"type": "video",
"duration": 317,
"publishDate": "2016-09-06T11:15:00.000Z"
},
{
"id": "USUV71505107",
"title": "Sia - Cheap Thrills (Lyric Video) ft. Sean Paul",
"artists": [
{
"id": "USUV71300188",
"name": "Sia"
}
],
"thumbnails": [
{
"url": "https://pmimages.blob.core.windows.net/thumbs/NO_JPEG_VERTICAL_CROPPED_LARGE/USUV71505107.jpg"
}
],
"url": "https://www.vevo.com/watch/sia/cheap-thrills-(lyric-video)-ft-sean-paul/USUV71505107",
"type": "video",
"duration": 247,
"publishDate": "2016-02-11T01:00:00.000Z"
}
]
}
使用 Vevo API 可以实现基于用户和当前视频推荐相关视频。示例代码如下:
curl -X GET \
'https://apiv2.vevo.com/recommendations?video_id=USRV81700834' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Vevo-App-Id: {your_app_id}' \
-H 'Vevo-Device-Id: {your_device_id}'
返回结果示例:
[
{
"id": "USUV71701852",
"title": "Dua Lipa - New Rules (Official Music Video)",
"artists": [
{
"id": "GBAHT1600298",
"name": "Dua Lipa"
}
],
"thumbnails": [
{
"url": "https://pmimages.blob.core.windows.net/thumbs/NO_JPEG_VERTICAL_CROPPED_LARGE/USUV71701852.jpg"
}
],
"url": "https://www.vevo.com/watch/dua-lipa/new-rules-(official-music-video)/USUV71701852",
"type": "video",
"duration": 210,
"publishDate": "2017-07-07T20:40:00.000Z"
},
{
"id": "GBUV71701629",
"title": "Jax Jones - Instruction ft. Demi Lovato, Stefflon Don",
"artists": [
{
"id": "GBAYE1602566",
"name": "Jax Jones"
}
],
"thumbnails": [
{
"url": "https://pmimages.blob.core.windows.net/thumbs/NO_JPEG_VERTICAL_CROPPED_LARGE/GBUV71701629.jpg"
}
],
"url": "https://www.vevo.com/watch/jax-jones/instruction/GBUV71701629",
"type": "video",
"duration": 186,
"publishDate": "2017-06-16T17:20:00.000Z"
}
]
使用 Vevo API 可以实现播放 Vevo 视频。示例代码如下:
curl -X GET \
'https://apiv2.vevo.com/playlists/USRV81700834?include_videos=true&include_albums=false' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Vevo-App-Id: {your_app_id}' \
-H 'Vevo-Device-Id: {your_device_id}'
返回结果示例:
{
"id": "USRV81700834",
"title": "The Chainsmokers - Save Yourself (Lyric Video) ft. Nghtmre",
"artists": [
{
"id": "USX9P1811137",
"name": "The Chainsmokers"
},
{
"id": "USX9X1813019",
"name": "NGHTMRE"
}
],
"description": null,
"thumbnails": [
{
"url": "https://pmimages.blob.core.windows.net/thumbs/NO_JPEG_VERTICAL_CROPPED_LARGE/USRV81700834.jpg"
}
],
"tags": [
"The Chainsmokers",
"Save Yourself",
"Nghtmre",
"Lyric",
"Lyric Video",
"New Song",
"Drew Taggart",
"Alex Pall",
"Music Video",
"Electronic",
"Dance",
"Pop"
],
"videos": [
{
"id": "USUV71801324",
"title": "The Chainsmokers ft. Emily Warren - Side Effects (Lyric Video)",
"artists": [
{
"id": "USX9P1811137",
"name": "The Chainsmokers"
},
{
"id": "USUV71702601",
"name": "Emily Warren"
}
],
"thumbnails": [
{
"url": "https://pmimages.blob.core.windows.net/thumbs/NO_JPEG_VERTICAL_CROPPED_LARGE/USUV71801324.jpg"
}
],
"url": "https://www.vevo.com/watch/the-chainsmokers/side-effects-(lyric-video)/USUV71801324",
"type": "video",
"duration": 165,
"publishDate": "2018-08-21T21:05:00.000+00:00"
}
]
}
以上介绍了 Vevo API 的三个常用接口,分别是搜索、推荐和播放。通过 Vevo API,可以轻松地集成 Vevo 音乐视频服务到你的应用程序中,让用户在应用中观看 Vevo 音乐视频。Vevo API 的返回结果为 JSON 格式,可以方便地解析处理。