Comparing version 1.5.5 to 1.5.6
#!/usr/bin/env node | ||
// var lib = require('../lib/index.js'); | ||
// var news = lib.terminalTimes(); | ||
// | ||
// console.log(news); | ||
var lib = require('../lib/index.js'); | ||
var news = lib.terminalTimes(); | ||
console.log(news); |
@@ -6,40 +6,40 @@ 'use strict'; | ||
function terminalTimesDeprecated(){ | ||
var reqOptions = { | ||
url: "https://www.nytimes.com", | ||
headers: { | ||
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" | ||
} | ||
}; | ||
request(reqOptions, function(error, response, body) { | ||
if (error) { | ||
console.log("error with http request\n", error); | ||
} else if (!error && response.statusCode) { | ||
let $ = cheerio.load(body); | ||
$('a').each(function(i, elem) { | ||
var current = $(this).text(); | ||
var link = $(this).attr('href'); | ||
current = current.replace(/ /g, ''); | ||
current = current.replace(/(\r\n|\n|\r)/gm, ""); | ||
if(link.indexOf('2018') > -1 && (current.length > 2)){ | ||
var topLine = ''; | ||
var bottomLine = ''; | ||
for(var i = 0; i < current.length + 5; i++){ | ||
topLine = topLine + '-'; | ||
} | ||
for(var i = 0; i < link.length + 4; i++){ | ||
bottomLine = bottomLine + '-'; | ||
} | ||
console.log("\n "+topLine+"\n |",current, " |\n "+bottomLine); | ||
console.log(" |",link, "|\n "+bottomLine); | ||
} | ||
}); | ||
} | ||
}); | ||
}; | ||
// function terminalTimesDeprecated(){ | ||
// | ||
// var reqOptions = { | ||
// url: "https://www.nytimes.com", | ||
// headers: { | ||
// 'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" | ||
// } | ||
// }; | ||
// | ||
// request(reqOptions, function(error, response, body) { | ||
// if (error) { | ||
// console.log("error with http request\n", error); | ||
// } else if (!error && response.statusCode) { | ||
// let $ = cheerio.load(body); | ||
// $('a').each(function(i, elem) { | ||
// var current = $(this).text(); | ||
// var link = $(this).attr('href'); | ||
// current = current.replace(/ /g, ''); | ||
// current = current.replace(/(\r\n|\n|\r)/gm, ""); | ||
// | ||
// if(link.indexOf('2018') > -1 && (current.length > 2)){ | ||
// var topLine = ''; | ||
// var bottomLine = ''; | ||
// for(var i = 0; i < current.length + 5; i++){ | ||
// topLine = topLine + '-'; | ||
// } | ||
// for(var i = 0; i < link.length + 4; i++){ | ||
// bottomLine = bottomLine + '-'; | ||
// } | ||
// | ||
// console.log("\n "+topLine+"\n |",current, " |\n "+bottomLine); | ||
// console.log(" |",link, "|\n "+bottomLine); | ||
// } | ||
// }); | ||
// } | ||
// }); | ||
// | ||
// }; | ||
terminalTimes() | ||
@@ -46,0 +46,0 @@ function terminalTimes(){ |
{ | ||
"name": "terminews", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"description": "read the latest news headlines from your terminal window", | ||
@@ -10,3 +10,3 @@ "main": "./lib/index.js", | ||
"bin": { | ||
"news": "bin/index.js" | ||
"news": "bin/news.js" | ||
}, | ||
@@ -13,0 +13,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14721
275