Skip to content

Instantly share code, notes, and snippets.

@kuu
Last active August 7, 2018 23:21
Show Gist options
  • Save kuu/1c7092acf84295fbdc51ddcec6adb60c to your computer and use it in GitHub Desktop.
Save kuu/1c7092acf84295fbdc51ddcec6adb60c to your computer and use it in GitHub Desktop.
Print stream info
const OoyalaApi = require('ooyala-api');
const api = new OoyalaApi('API Key', 'API Secret', {concurrency: 6});
print();
function print() {
return api.get('/v2/assets', {where: `asset_type='video'`, limit: 500}, {recursive: true})
.then(async items => {
for (const asset of items) {
await printAsset(asset);
}
})
.catch(err => {
console.error(err);
});
}
function printAsset(asset) {
console.log('---');
console.log(asset.created_at);
console.log(asset.embed_code);
return api.get('/v2/assets/' + asset.embed_code + '/streams')
.then(streams => {
console.log(streams);
})
.catch(err => {
console.error(err);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment