Last active
          October 21, 2016 01:05 
        
      - 
      
- 
        Save kristopherjohnson/f71ab70ecc57353adf3b60f26a1ba515 to your computer and use it in GitHub Desktop. 
    Get what's currently showing on Turner Classic Movies
  
        
  
    
      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
    
  
  
    
  | #!/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() | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Ongoing development is at https://github.com/kristopherjohnson/kjtcmws.