Last active
November 3, 2016 03:59
-
-
Save kuu/a6244668de8f64f06b792e83d1cfc1f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Script (requires node 6+) | |
const fetch = require('node-fetch'); | |
const baseURL = 'http://player.ooyala.com'; | |
const pcode = 'BtbmUyOlamRiH-S0S-iUeNvf_ghr'; | |
const embedCode = 'tzNDI1NzE6gt3qQPR46SU5yi9lDEYLRJ'; | |
const queryString = 'device=html5&domain=comment.my-demo.link'; | |
const requestURL = `${baseURL}/sas/player_api/v1/authorization/embed_code/${pcode}/${embedCode}?${queryString}`; | |
fetch(requestURL) | |
.then(res => { | |
if (res.status === 200) { | |
return res.json(); | |
} else { | |
return new Error(`${res.status} ${res.statusText}`); | |
} | |
}).then(data => { | |
console.log(data); | |
}).catch(err => { | |
console.error(`${err.message} ${err.stack}`); | |
}); | |
/* | |
Response (example) | |
----- | |
{ authorization_data: | |
{ tzNDI1NzE6gt3qQPR46SU5yi9lDEYLRJ: | |
{ authorized: true, | |
code: '0', | |
message: 'authorized', | |
request_timestamp: '1478138008', | |
retry: null, | |
synd_rule_failures: null, | |
require_heartbeat: false, | |
restrict_devices: false, | |
streams: [] } }, | |
user_info: | |
{ ip_address: '204.124.203.100', | |
domain: 'comment.my-demo.link', | |
request_timestamp: '1478138008', | |
country: 'US', | |
timezone: -7, | |
continent: 'NORTH AMERICA' }, | |
debug_data: | |
{ server_latency: '231.12231599999998', | |
request_id: 'b3af04e58352b97cc86bfe776f32f2ff', | |
user_info: { request_timestamp: '1478138008' }, | |
provider_enabled_ssl: false }, | |
signature: '1TsCIHMd+VZVtl1xBbWbUJpQdCRxbZ05sUBOVYZxEV0=' } | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment