Appearance
文件扫描
API 主地址:https://cn-api-v2.acrcloud.cn/api
请求时在 hearder 中必须携带 Authorization Bearer Token。
如果你不知道 Authorization Bearer Token 是什么, 请查看 AccessToken 部分。
提示
请注意 Authorization 的值必须以「Bearer 」开头且与获取到的 access token 中有一个空格
下面是一个例子:
python
headers = {'Authorization': Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.qzoqZ8EOWghqmiaYp_Bf4olGiclMMFL9UQJrx57zJNz8pAP1xsPQhVYdBYsJoP37o9ojT0MquvC1bm98xtTgZK_lkNwI9ukVTaSOyG191ifVrqxN4JJgKdaiPePIJJkoz1xwcQjPwmwdO2OHtVoAp3VZVQgNW9XK1ZCO_BFOM_y2wYnJE2SBGX8FxucSo5ttmzV4WVC86UkN4TA8SE_PNxI8shsi3ySV0KsVYWsCN16zkLXbOIUExmNot4HQKgMucgjrNkeZ5afNMCi9r51CRa9rvoWhQs8G4ZAYT7IwhRgGAuDxQyZKjRlCrpz3MHh6sTNi16ibTfA1pLW6lqkalsLhaULPqShrkreQCO6OSurhVXKLOvjKLOzySjUdFNVJBy9JgqDggvgYrIxLluK5zaiLM9wXuF07Dp25-T1hKXjBY0xBJu6ZwDl5NbFmLqB5owwDpG8MwYFeNqFXcspdwDlAR5qyG3DgvmaUerry1-f8QQLzNOYFgODSNxZRGy6QpwMx4NkGk2ypzm7rgXcuDKcYZ_1fc8nnia97uD9D-k1p5RJJC4Zs-NWlDU3L9Q0jTSJhyfVr9GIMsUSXk00rIoPtwz5i7pARMdD-hwIt3dkAOZSW-b3e_U_Fpw}
文件扫描 API 列表
URL | 方法 | 说明 |
---|---|---|
/fs-containers | POST | 创建一个文件容器 |
/fs-containers | GET | 获取文件容器列表 |
/fs-containers/:container_id | GET | 获取文件容器信息 |
/fs-containers/:container_id | DELETE | 删除文件容器 |
/fs-containers/:container_id/files | POST | 提交要扫描的文件或者链接 |
/fs-containers/:container_id/files | GET | 获取文件容器中的文件 |
/fs-containers/:container_id/files/:file_id | GET | 获取文件的扫描结果 |
/fs-containers/:container_id/files/:ids | DELETE | 删除文件 |
/fs-containers/:container_id/files/:file_id/rescan | PUT | 重新扫描 |
callback request | - | 文件扫描完成 callback 到你的接口 |
创建文件容器
创建文件容器
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers
请求方法: POST
参数:
参数名 | 类型 | 描述 |
---|---|---|
name | string | 文件容器名称 |
region | string | 区名,cn-north-1(中国大陆目前只有一个区所以直接写cn-north-1即可) |
audio_type | string | 音频类型,linein |
buckets | array | 识别的资源库,列表,需要填写资源库的id,如果你想识别音乐这里需要写 ['ACRCloud Music'],如果你想同时识别自己资源库内容可以写 ['ACRCloud Music', 888, 999] |
engine | string | 引擎类型,单选,1|2|3|4, 1:Audio Fingerprinting 2:Cover Songs 3:Audio Fingerprinting & Cover songs 4:Speech to Text |
policy | json | {"type":"traverse", "interval":0, "rec_length:10} 或者 {"type":"points", "points":3} 。type可以是traverse或者points,分别为遍历和点扫,interval为每次扫描的间隔, points为扫描的次数,rec_length为每次识别的长度 |
callback_url | string | 用户的 callback 地址,当扫描完成之后会提交一个请求到该地址 |
返回值:
Response
json
{
"data": {
"id": 123456,
"uid": 123,
"region": "eu-west-1",
"name": "container name",
"buckets": [
{
"id": 23,
"name": "ACRCloud Music",
"type": "ACRCloudFile",
"metadata_template": null
}
],
"audio_type": "linein",
"num": 1,
"size": 14,
"policy": {
"type": "traverse",
"interval": 0,
"rec_length": 10
},
"engine": 1,
"callback_url": null,
"created_at": "2023-04-28T07:53:40.000000Z",
"updated_at": "2023-04-28T07:53:40.000000Z"
}
}
获取文件容器列表
获取文件容器列表
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers
请求方法: GET
参数名 | 类型 | 描述 |
---|---|---|
region | string | 区名,cn-north-1(中国大陆目前只有一个区所以直接写cn-north-1即可) |
page | int | 翻页的页数 |
per_page | int | 每页的个数 |
返回值:
Response
json
{
"data": [
{
"id": 899,
"uid": 114,
"region": "cn-north-1",
"name": "song_filescan",
"buckets": [
{
"id": 23,
"name": "ACRCloud Music",
"type": "ACRCloudFile",
"metadata_template": null
}
],
"audio_type": "linein",
"num": 1521,
"size": 211968,
"policy": {
"type": "traverse",
"interval": 0,
"points": 3,
"rec_length": 10
},
"engine": 2,
"callback_url": "",
"created_at": "2023-03-28T03:49:43.000000Z",
"updated_at": "2023-03-28T03:49:43.000000Z"
}
]
}
获取文件容器信息
获取文件容器信息
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers/:container_id
请求方法: GET
路径:
- 「:container_id」替换成你的文件容器的container_id
返回值:
Response
json
{
"data": {
"id": 123456,
"uid": 123,
"region": "eu-west-1",
"name": "container name",
"buckets": [
{
"id": 23,
"name": "ACRCloud Music",
"type": "ACRCloudFile",
"metadata_template": null
}
],
"audio_type": "linein",
"num": 1,
"size": 14,
"policy": {
"type": "traverse",
"interval": 0,
"rec_length": 10
},
"engine": 1,
"callback_url": null,
"created_at": "2023-04-28T07:53:40.000000Z",
"updated_at": "2023-04-28T07:53:40.000000Z"
}
}
删除文件容器
删除文件容器
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers/:container_id
请求方法: DELETE
路径:
- 「:container_id」替换成你的文件容器的container_id
提交要扫描的文件或者链接
提交要扫描的文件或者链接
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers/:container_id/files
请求方法: POST
路径:
- 「:container_id」替换成你的文件容器的container_id
参数:
参数名 | 类型 | 描述 |
---|---|---|
file | object | 文件内容, 需要 data_type 为 audio 或者 fingerprint |
region | string | 区名,cn-north-1(中国大陆目前只有一个区所以直接写cn-north-1即可) |
data_type | string | 文件类型,单选,audio |
url | string | 文件地址,如果 data_type 为 platform 或者 audio_url 时你需要填写该字段,如 http://example.com/123.mp3 |
返回值:
Response
json
{
"data": {
"uid": 19,
"cid": 10005,
"name": "886443683402_US4D80623007.lo",
"duration": 159.56,
"uri": "audio:886443683402_US4D80623007.lo",
"data_type": "audio",
"method": 1,
"count": 0,
"state": 0,
"updated_at": "2021-04-23T07:33:21.000000Z",
"created_at": "2021-04-23T07:33:21.000000Z",
"id": "9d0f2c36-0265-46c2-b3e4-c0c2d0b9eb92",
"total": 1
}
}
获取文件容器中的文件
获取文件容器中的文件
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers/:container_id/files
请求方法: GET
路径:
- 「:container_id」替换成你的文件容器的container_id
参数:
参数名 | 类型 | 描述 |
---|---|---|
search | string | 搜索关键词 |
page | int | 翻页的页数 |
per_page | int | 每页的个数 |
with_result | int | 是否展示扫描结果,0 |
state | int | 0|1|-1|-2, 0:processing,1:Ready,-1: No results (No results were recognized from the file),-2: Error |
返回值:
Response
json
{
"data":[
{
"id":"fd0cbc13-bb69-41ed-abbb-1ed6f25c3b02",
"uid":19,
"cid":10005,
"name":"Camilo - Millones (Official Video)",
"duration":222,
"uri":"youtube:video:krP539YBF7U",
"data_type":"youtube",
"method":1,
"count":1,
"state":1,
"created_at":"2021-04-08T10:23:29.000000Z",
"updated_at":"2021-04-23T02:58:04.000000Z",
"total":1,
"results":{
"music":[
{
"played_duration":220,
"type":"traverse",
"result":{
"album":{
"name":"Mis Manos"
},
"play_offset_ms":19780,
"sample_begin_time_offset_ms":0,
"contributors":{
"composers":[
"Camilo Echeverry",
"Édgar Barrera"
],
"lyricists":[
"Camilo Echeverry",
"Édgar Barrera"
]
},
"title":"Millones",
"result_from":3,
"release_date":"2021-03-04",
"sample_end_time_offset_ms":9440,
"genres":[
{
"name":"Latin Pop"
}
],
"label":"SME - Sony Music Latin",
"db_end_time_offset_ms":19300,
"score":100,
"db_begin_time_offset_ms":9860,
"artists":[
{
"name":"Camilo"
}
],
"duration_ms":221000,
"external_ids":{
"isrc":"USSD12100051",
"upc":"886449088867"
},
"acrid":"300f34d92ec1f3a7397bb2bb9cddf884",
"external_metadata":{
"spotify":{
"album":{
"name":"Mis Manos"
},
"track":{
"name":"Millones",
"id":"3YAnNBdk0uHyakXXzMbNJq"
},
"artists":[
{
"name":"Camilo"
}
]
},
"deezer":{
"album":{
"name":""
},
"track":{
"name":"Millones",
"id":"1260566282"
},
"artists":[
{
"name":"Camilo"
}
]
}
}
},
"offset":0
}
]
}
},
{
"id":"5c2cfaa2-6024-4775-ac24-1aa7b4786c86",
"uid":19,
"cid":10005,
"name":"Lil Tjay - Love Hurts (Feat. Toosii) [Official Video]",
"duration":247,
"uri":"youtube:video:V-IDVYH3YjA",
"data_type":"youtube",
"method":1,
"count":1,
"state":1,
"created_at":"2021-04-08T08:26:55.000000Z",
"updated_at":"2021-04-23T02:58:04.000000Z",
"total":1,
"results":{
"music":[
{
"played_duration":5,
"type":"traverse",
"result":{
"album":{
"name":"my ex called"
},
"play_offset_ms":6440,
"sample_begin_time_offset_ms":4260,
"title":"my ex called",
"result_from":3,
"release_date":"2020-02-21",
"sample_end_time_offset_ms":8860,
"label":"Thrill$",
"db_end_time_offset_ms":4600,
"score":100,
"db_begin_time_offset_ms":0,
"artists":[
{
"name":"Thrill$"
}
],
"duration_ms":168920,
"external_ids":{
"isrc":"QZJG52083365",
"upc":"194923628486"
},
"acrid":"269e27604f4be4c3167fc3751f5551c3",
"external_metadata":{
"deezer":{
"album":{
"name":""
},
"track":{
"name":"Havit",
"id":"1098021672"
},
"artists":[
{
"name":"Of_mannyg"
}
]
}
}
},
"offset":14
},
{
"played_duration":14,
"type":"traverse",
"result":{
"album":{
"name":"Lost Files"
},
"play_offset_ms":5340,
"sample_begin_time_offset_ms":4080,
"title":"In the Streets",
"result_from":1,
"release_date":"2020-10-26",
"sample_end_time_offset_ms":9260,
"label":"Hitta Huncho",
"db_end_time_offset_ms":5180,
"score":100,
"db_begin_time_offset_ms":0,
"artists":[
{
"name":"Hitta Huncho"
}
],
"duration_ms":160940,
"external_ids":{
"isrc":"TCAFE2056515",
"upc":"859742903298"
},
"acrid":"e63ee358a9357a1e181cd8ce858d78fd",
"external_metadata":{
"deezer":{
"album":{
"name":""
},
"track":{
"name":"In the Streets",
"id":"1131507852"
},
"artists":[
{
"name":"Hitta Huncho"
}
]
}
}
},
"offset":24
},
{
"played_duration":209,
"type":"traverse",
"result":{
"album":{
"name":"Destined 2 Win"
},
"play_offset_ms":25880,
"sample_begin_time_offset_ms":0,
"title":"Love Hurts",
"result_from":1,
"release_date":"2021-04-02",
"sample_end_time_offset_ms":8200,
"genres":[
{
"name":"Hip Hop"
}
],
"label":"Columbia",
"db_end_time_offset_ms":24100,
"score":100,
"db_begin_time_offset_ms":15900,
"artists":[
{
"name":"Lil Tjay"
}
],
"duration_ms":222100,
"external_ids":{
"isrc":"USSM12101539",
"upc":"886449173587"
},
"acrid":"d981bc8a8a55b06d15d5ea0f4957873c",
"external_metadata":{
"spotify":{
"album":{
"name":"Destined 2 Win"
},
"track":{
"name":"Love Hurts (feat. Toosii)",
"id":"2ULQtFHTzUK0DqcqWUlXxw"
},
"artists":[
{
"name":"Lil Tjay"
},
{
"name":"Toosii"
}
]
}
}
},
"offset":30
}
]
}
}
],
"links":{
"first":"https://ap-api-v2.acrcloud.com/api/fs-containers/10005/files?page=1",
"last":"https://ap-api-v2.acrcloud.com/api/fs-containers/10005/files?page=1",
"prev":null,
"next":null
},
"meta":{
"current_page":1,
"from":1,
"last_page":1,
"path":"https://ap-api-v2.acrcloud.com/api/fs-containers/10005/files",
"per_page":"20",
"to":2,
"total":2
}
}
获取文件的扫描结果
获取文件的扫描结果
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers/:container_id/files/:file_id
请求方法: GET
路径:
- 「:container_id」替换成你的文件容器的 container_id
- 「:file_id」替换成你的文件的 file_id
参数:
参数名 | 类型 | 描述 |
---|---|---|
page | int | 翻页的页数 |
per_page | int | 每页的个数 |
返回值:
Response
json
{
"data": [
{
"playlist_id": "PLHFeMk_LSwG5pMfNQyeaqk4bUBPiFvPXF",
"vid": "1UFc0CQzVt4",
"title": "Beyoncé X10: Walk To Stage",
"duration": 51,
"created_at": "2021-04-23T05:53:39.000000Z",
"results": null,
"state": 0
},
{
"playlist_id": "PLHFeMk_LSwG5pMfNQyeaqk4bUBPiFvPXF",
"vid": "i8FjKlOdd3U",
"title": "Beyoncé X10: Album Release Party",
"duration": 51,
"created_at": "2021-04-23T05:53:39.000000Z",
"results": null,
"state": 0
},
{
"playlist_id": "PLHFeMk_LSwG5pMfNQyeaqk4bUBPiFvPXF",
"vid": "0aip4XarbNM",
"title": "The 2015 Official Calendar",
"duration": 15,
"created_at": "2021-04-23T05:53:39.000000Z",
"results": {
"music": [
{
"count": 1,
"type": "points",
"result": {
"album": {
"name": "Carter (Deluxe Edition)"
},
"play_offset_ms": 98020,
"sample_begin_time_offset_ms": 0,
"title": "Yoncé",
"result_from": 3,
"release_date": "2016-01-11",
"sample_end_time_offset_ms": 8760,
"label": "Fél Carter",
"db_end_time_offset_ms": 97000,
"score": 100,
"db_begin_time_offset_ms": 88240,
"artists": [
{
"name": "Fél Carter"
}
],
"duration_ms": 103000,
"external_ids": {
"isrc": "BRBMG0499954",
"upc": "1827849181757"
},
"acrid": "d5e4f462af3d648d02fb6b22325b22c0",
"external_metadata": {
"deezer": {
"album": {
"name": "Carter (Deluxe Edition)"
},
"track": {
"name": "Yoncé",
"id": "117149072"
},
"artists": [
{
"name": "Fél Carter"
}
]
}
}
},
"offset": 0
}
]
},
"state": 1
},
{
"playlist_id": "PLHFeMk_LSwG5pMfNQyeaqk4bUBPiFvPXF",
"vid": "LmFjwtdCimQ",
"title": "BEYONCÉ Platinum Edition Box Set",
"duration": 21,
"created_at": "2021-04-23T05:53:39.000000Z",
"results": null,
"state": 0
},
{
"playlist_id": "PLHFeMk_LSwG5pMfNQyeaqk4bUBPiFvPXF",
"vid": "k4YRWT_Aldo",
"title": "Beyoncé - 7/11",
"duration": 217,
"created_at": "2021-04-23T05:53:39.000000Z",
"results": {
"music": [
{
"count": 3,
"type": "points",
"result": {
"album": {
"name": "BEYONCÉ [Platinum Edition]"
},
"play_offset_ms": 42460,
"sample_begin_time_offset_ms": 0,
"lyrics": {
"copyrights": [
"Kobalt Music Publishing Ltd.",
"Sony/ATV Music Publishing LLC",
"Warner/Chappell Music",
"Inc."
]
},
"contributors": {
"composers": [
"Sidney Swift",
"Noel Fisher",
"Beyoncé",
"Adrian Bruesch"
],
"lyricists": [
"Noel Fisher",
"Adrian Bruesch",
"Beyonce Knowles",
"Sidney Swift"
]
},
"title": "7/11",
"result_from": 3,
"release_date": "2014-11-24",
"sample_end_time_offset_ms": 8820,
"genres": [
{
"name": "Pop"
}
],
"label": "Parkwood Entertainment/Columbia",
"duration_ms": 213520,
"score": 100,
"db_begin_time_offset_ms": 32700,
"artists": [
{
"name": "Beyoncé"
}
],
"db_end_time_offset_ms": 41520,
"external_ids": {
"isrc": "USSM11408532",
"iswc": "T-803.469.303-4",
"upc": "886444975025"
},
"acrid": "a201b20cf560b893e636954c4976eb93",
"external_metadata": {
"musicbrainz": [
{
"track": {
"id": "f9e47e74-b21b-4adb-b47d-732006ade023"
}
}
],
"spotify": {
"album": {
"name": "BEYONCÉ [Platinum Edition]"
},
"track": {
"name": "7/11",
"id": "1A7QIlETJSCFXzyp3cSbak"
},
"artists": [
{
"name": "Beyoncé"
}
]
},
"deezer": {
"album": {
"name": "BEYONCÉ [Platinum Edition]",
"id": "9163719"
},
"track": {
"name": "7/11",
"id": "90408897"
},
"artists": [
{
"name": "Beyoncé",
"id": "145"
}
]
},
"youtube": {
"vid": "k4YRWT_Aldo"
}
}
},
"offset": 0
}
]
},
"state": 1
},
{
"playlist_id": "PLHFeMk_LSwG5pMfNQyeaqk4bUBPiFvPXF",
"vid": "v01C7uQ9yUg",
"title": "BEYONCÉ Platinum Edition",
"duration": 16,
"created_at": "2021-04-23T05:53:39.000000Z",
"results": {
"music": [
{
"count": 1,
"type": "points",
"result": {
"album": {
"name": "I Created The Remix"
},
"play_offset_ms": 153020,
"sample_begin_time_offset_ms": 0,
"title": "Yonce",
"result_from": 3,
"release_date": "2018-04-06",
"sample_end_time_offset_ms": 8980,
"label": "Luvproductionz Music Group",
"db_end_time_offset_ms": 152140,
"score": 100,
"db_begin_time_offset_ms": 143160,
"artists": [
{
"name": "LV the Voice"
}
],
"duration_ms": 305060,
"external_ids": {
"isrc": "QMEZE1809133",
"upc": "5054960589049"
},
"acrid": "25fdb1fb21afb8247eacf69290e6bc93",
"external_metadata": {
"spotify": {
"album": {
"name": "I Created The Remix"
},
"track": {
"name": "Yonce - Remix",
"id": "3IgjRehr5wPC4RICcoJHyZ"
},
"artists": [
{
"name": "LV The Voice"
}
]
}
}
},
"offset": 0
}
]
},
"state": 1
}
],
"links": {
"first": "https://ap-api-v2.acrcloud.com/api/fs-containers/10055/files/f60c40d8-f35e-488e-bca4-105d85b080dc?page=1",
"last": "https://ap-api-v2.acrcloud.com/api/fs-containers/10055/files/f60c40d8-f35e-488e-bca4-105d85b080dc?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://ap-api-v2.acrcloud.com/api/fs-containers/10055/files/f60c40d8-f35e-488e-bca4-105d85b080dc",
"per_page": "20",
"to": 6,
"total": 6
}
}
删除文件
删除文件
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers/:container_id/files/:ids
请求方法: DELETE
路径:
- 「:container_id」替换成你的文件容器的 container_id
- 「:ids」替换成你的文件的 ids, 可以为多个,以英文逗号隔开','
重新扫描
重新扫描
API 地址:https://cn-api-v2.acrcloud.cn/api/fs-containers/:container_id/files/:file_id/rescan
请求方法: PUT
路径:
- 「:container_id」替换成你的文件容器的 container_id
- 「:file_id」替换成你的文件的 file_id
callback request
用户的 callback 地址,当扫描完成之后会提交一个请求到该地址
请求地址: https://callback-url.com/path
请求方法: POST
参数:
参数名 | 类型 | 描述 |
---|---|---|
file_id | string | 文件的 file_id |
cid | int | 文件容器的 id |
state | int | 1|-1|-2, 1:Ready,-1: No results (No results were recognized from the file),-2: Error |
results | json | 如果 state 为 1 时,将会携带结果,格式:{"music":[{},{}...],"custom_files":[{},{},...],"cover_files":[{},{},...]} |