Closed anonym24 closed 6 years ago
We are using Promise
s here, and it looks like you aren't catching the errors, so maybe they're being silently dropped. Maybe try tacking on and see how it goes:
.catch(console.error);
It was because of https. Originally we have http in js file:
var getAccessToken = function(channel) {
// Get access token
return new Promise(function(resolve, reject) {
request
.get('http://api.twitch.tv/api/channels/' + channel + '/access_token')
.set({ 'Client-ID': clid })
.end(function(err, res) {
if (err) return reject(err);
if (!res.ok) return reject(new Error('Could not access the twitch API to get the access token, maybe your internet or twitch is down.'));
return resolve(res.body);
});
});
}
var getPlaylist = function(channel, accessToken) {
// Get the playlist with given access token data (parsed /access_token response)
return new Promise(function(resolve, reject) {
request
.get('http://usher.twitch.tv/api/channel/hls/' + channel + '.m3u8')
It works ok on Ubuntu with node (and it doesn't work with https)
But with Chrome extension and Twitch channel page opened it requires https (doesn't wok with http)
Interesting. This project was designed originally for node as the repo name suggests so I didn't have browser support in mind, but as I have hinted to I may look into that in the future if it is feasible.
When I run node main.js:
it would return streams (print them to Ubuntu terminal console)
but after sometimes it doesn't print anything (doesn't return anything?)
what could be a problem here?