Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terminews

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terminews - npm Package Compare versions

Comparing version 1.5.5 to 1.5.6

8

bin/news.js
#!/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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc