The Codez #!/usr/bin/env node 'use strict'; var cheerio = require('cheerio'); var request = require('request'); var TPB_URL = 'https://thepiratebay.la/top/207'; request(TPB_URL, function(err, resp, body) { if (err || resp.statusCode !== 200) { throw new Error("Couldn't reach thepiratebay... It might be down :("); } console.log('Top 100 Movies from The Pirate Bay'); console.log('----------------------------------\n'); var $ = cheerio.load(body); $('#content .detName a').each(function(index, element) { console.log(index, $(this).text()); }); }); index.js
Now It’s Your Turn ● Build a command line tool. ○ Scrape a website. ○ Print off cool information. ○ Can’t be too simple! Duh! ○ Make it useful! <3 ● Package it up. ● Deploy it to NPM. ● First person to deploy a working package gets a t-shirt!