Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Last active October 21, 2016 01:05
Show Gist options
  • Save kristopherjohnson/f71ab70ecc57353adf3b60f26a1ba515 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/f71ab70ecc57353adf3b60f26a1ba515 to your computer and use it in GitHub Desktop.
Get what's currently showing on Turner Classic Movies
#!/usr/bin/env node
const request = require('request');
// See <http://www.tcm.com/tcmws/v1/docs/welcome.html>
const url_base = 'http://www.tcm.com/tcmws/v1'
function showWhatsOnNow() {
request(`${url_base}/schedule/whatsOnNow/us.json`, (error, response, body) => {
if (error) {
console.log(error);
}
else if (response.statusCode == 200) {
const whatsOnNow = JSON.parse(body).tcm.schedule.whatsOnNow;
console.log(`Name: ${whatsOnNow.name}`);
console.log(`Description: ${whatsOnNow.description}`);
console.log(`Actors: ${whatsOnNow.actors}`);
console.log(`Director: ${whatsOnNow.tvDirectors}`);
console.log(`Production: ${whatsOnNow.productionData.productionCompanies}`);
console.log(`Genres: ${whatsOnNow.tvGenres}`);
}
else {
console.log(`Unexpected response status ${response.statusCode}`);
}
});
}
showWhatsOnNow()
@kristopherjohnson
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment