Created
September 27, 2018 13:14
-
-
Save tamascsaba/1ff870225fbb452b9db27bc0b71ebb04 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
const request = require('request'); | |
const listID = 'PLXqGVIkwHK4IpJPTd7s88fqyjjYB2g8yo' | |
const listUrl = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&key=AIzaSyAvNgxcJ67EZuioDBOuQffHkQa4qBv_eCI&playlistId=' + listID; | |
request.get(listUrl, (e, res, b) => { | |
if (!e && res.tatusCode == 200) { | |
console.log(b); | |
} | |
for(const item of b.items) { | |
const id = item.snippet.resourceId.videoId; | |
const url = 'https://www.youtube.com/watch?v=' + id; | |
request.post( | |
'http://10.30.255.33:5000/player/tracks', | |
{ json: {url: url, user: 'Tonyo' } }, | |
(error, response, body) => { | |
if (!error && response.statusCode == 200) { | |
console.log(body); | |
} | |
} | |
); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment