New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 2.0.8 to 2.9.0

verbose.js

85

index.js

@@ -1,84 +0,1 @@

#! /usr/bin/env node
var getnews = require('./reporter')
var editnews = require('./editor')
var { findArticleFlag } = require('./utilities')
console.log(`
___________ .__
\\\__ ___/__________ _____ |__| ____ ______ _ ________
| |_/ __ \\\_ __ \\\/ \\\| |/ \\\_/ __ \\\ \\\/ \\\/ / ___/
| |\\\ ___/| | \\\/ Y Y \\\ | | \\\ ___/\\\ /\\\___ \\\\
|____| \\\___ >__| |__|_| /__|___| /\\\___ >\\\/\\\_//____ >`);
console.log("\n\n TERMINEWS - READ THE NEWS IN YOUR TERMINAL ");
console.log("\n\n To open a link in your browser hold command and click the link \n\n\n");
const startThePresses = () => {
let numberOfArticles = findArticleFlag(process.argv)
getnews.reporter().then((result) => {
//getnews.reporter level
editnews.editor(result).then((newspaper) => {
//editnews.editor level
const shuffle = (newspaper) => {
var tmp, current, top = newspaper.length;
if(top) while(--top) {
current = Math.floor(Math.random() * (top + 1));
tmp = newspaper[current];
newspaper[current] = newspaper[top];
newspaper[top] = tmp;
}
for(var z = 0; z < numberOfArticles; z++){
var title = ''
var link = ''
var titleLength = 0
var linkLength = 0
var dottedLineA = ' '//starts with one whitespace
var dottedLineB = ' '//starts with one whitespace
if(newspaper[z][0][0].indexOf('Comments') === -1){
title = newspaper[z][0][0]
link = 'https://www.nytimes.com'+newspaper[z][0][1]
title.length > 100 ? title = title.substring(0, 100) + '...' : null
titleLength = title.length
for(var zz = 0; zz < titleLength+16; zz++){//+16 to account to Article, Link, and whitespace
dottedLineA = dottedLineA + '-'
}
linkLength = link.length
for(var zzz = 0; zzz < linkLength+16; zzz++){//+16 to account to Article, Link, and whitespace
dottedLineB = dottedLineB + '-'
}
console.log("\n"+dottedLineA)
console.log(" | Article: | " + title + " | ")
if(dottedLineA.length > dottedLineB.length){
console.log(dottedLineA)
}else{
console.log(dottedLineB)
}
console.log(" | Link: | " + link + " | ")
console.log(dottedLineB)
}
}
}
shuffle(newspaper)
})
.catch((e) => {/*editnews.editor level error*/ console.log('2catch.e:',e)})
})
.catch((e) => {/*getnews.reporter level error*/ console.log('1catch.e:',e)})
}
startThePresses()
const fetch=require("node-fetch");let cheerio=require("cheerio");console.log("\n ___________ .__\n \\__ ___/__________ _____ |__| ____ ______ _ ________\n | |_/ __ \\_ __ \\/ \\| |/ \\_/ __ \\ \\/ \\/ / ___/\n | |\\ ___/| | \\/ Y Y \\ | | \\ ___/\\ /\\___ \\\\\n |____| \\___ >__| |__|_| /__|___| /\\___ >\\/\\_//____ >"),console.log("\n\n TERMINEWS - READ THE HEADLINES IN YOUR TERMINAL "),console.log("\n\n To open a link in your browser hold command and click the link \n\n\n");const getUserAgent=()=>{var e=["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","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36","Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36","Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36","Mozilla/5.0 (Windows NT 4.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36","Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2117.157 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1866.237 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/4E423F","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1","Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10; rv:33.0) Gecko/20100101 Firefox/33.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20130401 Firefox/31.0","Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0","Mozilla/5.0 (X11; OpenBSD amd64; rv:28.0) Gecko/20100101 Firefox/28.0","Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0","Mozilla/5.0 (Windows NT 6.1; rv:27.3) Gecko/20130101 Firefox/27.3","Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:27.0) Gecko/20121011 Firefox/27.0Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0","Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0","Mozilla/5.0 (Windows NT 6.2; rv:22.0) Gecko/20130405 Firefox/23.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130406 Firefox/23.0","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20131011 Firefox/23.0","Mozilla/5.0 (Windows NT 6.2; rv:22.0) Gecko/20130405 Firefox/22.0","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:22.0) Gecko/20130328 Firefox/22.0","Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20130405 Firefox/22.0","Mozilla/5.0 (Microsoft Windows NT 6.2.9200.0); rv:22.0) Gecko/20130405 Firefox/22.0","Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/21.0.1","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/21.0.1","Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:21.0.0) Gecko/20121011 Firefox/21.0.0","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20130331 Firefox/21.0","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.0","Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0","Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20130514 Firefox/21.0","Mozilla/5.0 (Windows NT 6.2; rv:21.0) Gecko/20130326 Firefox/21.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130401 Firefox/21.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130331 Firefox/21.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130330 Firefox/21.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0","Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130401 Firefox/21.0","Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130328 Firefox/21.0","Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0","Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20130401 Firefox/21.0","Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20130331 Firefox/21.0","Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0","Mozilla/5.0 (Windows NT 5.0; rv:21.0) Gecko/20100101 Firefox/21.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0","Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121202 Firefox/17.0 Iceweasel/17.0.1","Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1 Iceweasel/15.0.1","Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0.1 Iceweasel/15.0.1","Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120724 Debian Iceweasel/15.0","Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0 Iceweasel/15.0","Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120721 Debian Iceweasel/15.0","Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0 Iceweasel/15.0","Mozilla/5.0 (X11; debian; Linux x86_64; rv:15.0) Gecko/20100101 Iceweasel/15.0","Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1 Iceweasel/14.0.1","Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1 Iceweasel/14.0.1","Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0 Iceweasel/14.0","Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Debian Iceweasel/14.0","Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0 Iceweasel/14.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1","Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Windows; U; Windows NT 6.1; ko-KR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Windows; U; Windows NT 6.1; fr-FR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Windows; U; Windows NT 6.1; cs-CZ) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Windows; U; Windows NT 6.0; ja-JP) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_8; zh-cn) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_8; ja-jp) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; ja-jp) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; zh-cn) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; sv-se) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; ko-kr) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; ja-jp) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; it-it) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; fr-fr) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; es-es) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-gb) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; de-de) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27","Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 7.0; InfoPath.3; .NET CLR 3.1.40767; Trident/6.0; en-IN)","Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)","Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)","Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)","Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)","Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)","Mozilla/4.0 (Compatible; MSIE 8.0; Windows NT 5.2; Trident/6.0)","Mozilla/4.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)","Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))","Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; InfoPath.3; MS-RTC LM 8; .NET4.0C; .NET4.0E)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/12.0.742.112)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; Tablet PC 2.0; InfoPath.3; .NET4.0C; .NET4.0E)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; FunWebProducts)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; chromeframe/13.0.782.215)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; chromeframe/11.0.696.57)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) chromeframe/10.0.648.205","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.1; SV1; .NET CLR 2.8.52393; WOW64; en-US)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; chromeframe/11.0.696.57)","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/4.0; GTB7.4; InfoPath.3; SV1; .NET CLR 3.1.76908; WOW64; en-US)"];return e[Math.floor(Math.random()*Math.floor(e.length))+1]},findArticleFlag=e=>{let i;e[1]&&"-"===e[1].charAt(0)?i=e[1].slice(1):e[2]&&"-"===e[2].charAt(0)&&(i=e[2].slice(1));let o=new Number(i);return(0==o||isNaN(o)||o>10)&&(o=30),o},getData=async e=>{try{const i={headers:{"User-Agent":getUserAgent()},method:"GET"},o=await fetch(e,i);return await o.text()}catch(e){throw new Error("Error in getData. Error:",e)}},editData=e=>new Promise((i,o)=>{let l=[],a=cheerio.load(e);try{a("a").each(function(e,o){const n=a(this).text().replace(/ /g,"").replace(/(\r\n|\n|\r)/gm,""),r=a(this).attr("href");r.indexOf(new Date(Date.now()).getFullYear())>-1&&-1===n.search("comments")&&n.length>3&&l.push([n,r]),i(l)})}catch(e){o(new Error(e))}}),displayData=e=>{let i=findArticleFlag(process.argv);var o,l,a=e.length;if(a)for(;--a;)o=e[l=Math.floor(Math.random()*(a+1))],e[l]=e[a],e[a]=o;for(var n=0;n<i;n++){var r="",M="",t=0,c=0,s=" ",W=" ";if(-1===e[n][0][0].indexOf("comments")){r=e[n][0],M="https://www.nytimes.com"+e[n][1],r.length>100&&(r=r.substring(0,100)+"..."),t=r.length;for(var T=0;T<t+16;T++)s+="-";c=M.length;for(var _=0;_<c+16;_++)W+="-";console.log("\n"+s),console.log(" | Article: | "+r.trim()+" | "),s.length>W.length?console.log(s):console.log(W),console.log(" | Link: | "+M+" | "),console.log(W)}}};getData("https://www.nytimes.com").then(e=>{editData(e).then(e=>{displayData(e)}).catch(e=>new Error(e))}).catch(e=>new Error(e));
{
"name": "terminews",
"version": "2.0.8",
"description": "read the latest news headlines from your terminal window",
"version": "2.9.0",
"description": "An updated version of terminews - read today's headllines from your terminal.",
"main": "index.js",

@@ -23,3 +23,3 @@ "scripts": {

"today",
"terminaltimes",
"events",
"terminews"

@@ -38,3 +38,4 @@ ],

"dependencies": {
"cheerio": "^1.0.0-rc.2"
"cheerio": "^1.0.0-rc.3",
"node-fetch": "^2.6.0"
},

@@ -41,0 +42,0 @@ "devDependencies": {

# terminews
#### We're back (now only one dependency - Cheerio.js, no intentional breakfast theme)! Recently refreshed and expanded to include simple testing to avoid future down time. Enjoy the news, once again, right from your terminal.
#### Enjoy the news, right from your terminal.
Read the day's headlines from your terminal. Want to read more the headlines (and using a Mac) hold command and click the link.
![Downloads](https://img.shields.io/npm/dw/terminews.svg)

@@ -11,3 +13,3 @@ ![Downloads](https://img.shields.io/npm/dm/terminews.svg)

I absolutely love keeping up with all the news in our wild world. I may not agree with the newsmakers, but I can appreciate all the journalists and news organizations who work hard, day in and day out, to bring us the news. I am only responsible for bringing the news to the terminal. Don't leave your desk. Enjoy!
I absolutely love keeping up with all the news in our wild world. I may not agree with the newsmakers, but I can appreciate all the journalists and news organizations who work hard, day in and day out, to bring us the news. I am only responsible for bringing the news to the terminal. Enjoy!

@@ -34,4 +36,2 @@ **Read random news headlines right from your terminal**.

$ news -4
or
$ news -10
```

@@ -43,3 +43,3 @@ ** number ** the number of articles to return.

![example news](http://i66.tinypic.com/k3xh0h.png)
![example news](https://i.ibb.co/zV60hr5/Screen-Shot-2020-04-06-at-3-24-45-PM.png)

@@ -53,3 +53,3 @@ ## Seeking Input & Help

MIT
Copyright 2018 Daniel P. Dwyer <danielpatrickdwyer@gmail.com>
Copyright 2020 Daniel P. Dwyer <danielpatrickdwyer@gmail.com>

@@ -56,0 +56,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@@ -1,18 +0,18 @@

var expect = require('chai').expect
var getnews = require('../reporter')
var editnews = require('../editor')
// var expect = require('chai').expect
// var getnews = require('../reporter')
// var editnews = require('../editor')
it('reporters are working - stories are generating', function(done) {
getnews.reporter().then((result) => {
expect(result.length > 300000).to.be.true;
done();
})
});
// it('reporters are working - stories are generating', function(done) {
// getnews.reporter().then((result) => {
// expect(result.length > 300000).to.be.true;
// done();
// })
// });
it('the stories appear to be news we can work with', function(done) {
getnews.reporter().then((result) => {
expect(result[0]+result[1]+result[2]+result[3]+result[4]+result[5]+result[6]).to.equal('<!DOCTY');
done();
})
});
// it('the stories appear to be news we can work with', function(done) {
// getnews.reporter().then((result) => {
// expect(result[0]+result[1]+result[2]+result[3]+result[4]+result[5]+result[6]).to.equal('<!DOCTY');
// done();
// })
// });

@@ -1,58 +0,58 @@

const { findArticleFlag } = require('../utilities')
const { assert } = require('chai')
// const { findArticleFlag } = require('../utilities')
// const { assert } = require('chai')
describe('findArticleFlag()', () => {
it('Handles arg[1] as flag', () => {
let args = ['arg0', '-4']
let numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 4)
})
// describe('findArticleFlag()', () => {
// it('Handles arg[1] as flag', () => {
// let args = ['arg0', '-4']
// let numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 4)
// })
it('Handles arg[2] as flag', () => {
let args = ['arg0', 'arg1', '-9']
let numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 9)
})
// it('Handles arg[2] as flag', () => {
// let args = ['arg0', 'arg1', '-9']
// let numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 9)
// })
it('Handles various values that are not numbers and defaults to 10', () => {
let args = ['arg0', '-[]']
let numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
// it('Handles various values that are not numbers and defaults to 10', () => {
// let args = ['arg0', '-[]']
// let numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
args[1] = '-false'
numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
// args[1] = '-false'
// numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
args[1] = '-badValue'
numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
// args[1] = '-badValue'
// numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
args[1] = '-true'
numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
// args[1] = '-true'
// numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
args[1] = '-[]'
numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
// args[1] = '-[]'
// numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
args[1] = '-{}'
numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
// args[1] = '-{}'
// numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
args[1] = '-'
numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
})
// args[1] = '-'
// numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
// })
it('Handles no article flag', () => {
let args = ['arg0']
let numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
})
// it('Handles no article flag', () => {
// let args = ['arg0']
// let numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
// })
it('Handles numbers greater than 10', () => {
let args = ['arg0', '-100']
let numberOfArticles = findArticleFlag(args)
assert.equal(numberOfArticles, 10)
})
})
// it('Handles numbers greater than 10', () => {
// let args = ['arg0', '-100']
// let numberOfArticles = findArticleFlag(args)
// assert.equal(numberOfArticles, 10)
// })
// })
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