ACRCloud
Ask or search…
K
Links

Streams Results

get
https://api-v2.acrcloud.com
/api/bm-cs-projects/:pid/streams/:stream_id/results
Get the stream monitoring results
Parameters
Path
pid
number
The project id
stream_id
string
ID of the cake to get, for free of course.
Query
type
string
last: get the last results day: get the day results Default is day
date
string
Get all the results on this date. The format is YYYYmmdd (E.g. 20210201)
min_duration
number
Only return the results of played_duration greater than or equal to min_duration seconds (default: 0)
max_duration
number
Only return the results of played_duration less than or equal to max_duration seconds (default: 3600)
isrc_country
string
Only return results that match the isrc country code (E.g. DE, FR, IT, US)
with_false_positive
number
0: does not return results marked as false positive. (Default)
1: returns results marked false positive.
Header
Authorization
string
Bearer token
Accept
string
application/json
Responses
200
Curl #day
Curl #last
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/12417/streams/s-0xAHfNh/results?type=day&date=20210201' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/12417/streams/s-0xAHfNh/results?type=last' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'

The following is a sample script that displays the results in real-time

<?php
$project_id = "{project_id}";
$stream_id = "{stream_id}";
$token = "{bearer token}"; // https://docs.acrcloud.com/reference/console-api/accesstoken
$opts = [
"http" => [
"method" => "GET",
"header" => "Accept: application/json\r\n" .
"Authorization: Bearer " . $token . "\r\n"
]
];
$context = stream_context_create($opts);
$data = file_get_contents("https://api-v2.acrcloud.com/api/bm-cs-projects/" . $project_id . "/streams/" . $stream_id . "/results?type=last", false, $context);
$obj = json_decode($data, true);
# var_dump($obj);
$title = "";
$artists = "";
if (isset($obj['data']) && count($obj['data']) > 0) {
$metadata = $obj['data'][0]['metadata'];
if (array_key_exists('music', $metadata)) {
$music = $metadata['music'][0];
$title = $music['title'];
$arlist = [];
if (array_key_exists('artists', $music)) {
foreach($music['artists'] as $ar) {
$arlist[] = $ar['name'];
}
}
if (count($arlist) > 0) {
$artists = implode(', ', $arlist);
}
}
}
$ret = ['title'=>$title, 'artists'=>$artists, 'result'=>$obj];
print_r(json_encode($ret));
?>
get
https://api-v2.acrcloud.com
/api/bm-cs-projects/:pid/streams/:stream_id/unknown_results
Getting results not recognized but detected as music. (Note: This API is only available for streams with music detection enabled)
Parameters
Path
pid*
number
The project id
stream_id*
string
stream_id
Query
date*
string
Get all the results on this date. The format is YYYYmmdd (E.g. 20210201)
min_duration
number
Only return the results of played_duration greater than or equal to min_duration seconds (default: 0)
max_duration
number
Only return the results of played_duration less than or equal to max_duration seconds (default: 3600)
Header
Authorization*
string
Bearer token
Accept
string
application/json
Responses
200: OK
Curl
curl --location 'https://api-v2.acrcloud.com/api/bm-cs-projects/1234/streams/s-xxxxx/unknown_results?date=20231018&min_duration=60&max_duration=80' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
Last modified 2mo ago