Last active
August 7, 2018 23:21
-
-
Save kuu/1c7092acf84295fbdc51ddcec6adb60c to your computer and use it in GitHub Desktop.
Print stream info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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