Skip to content

Instantly share code, notes, and snippets.

@waltir
waltir / nightwatch_headless.js
Last active May 3, 2019
how to setup a headless environment for nightwatch.js
View nightwatch_headless.js
// The environment below is named 'headless' and is located in our nightwatch.conf.js file.
"headless": {
"desiredCapabilities": {
"chromeOptions": {
"args": [
"headless", // This is the line that tells nightwatch to run in a headless mode
],
},
"browserName": "chrome",
"javascriptEnabled": true
@waltir
waltir / cheerio_meta.js
Created May 2, 2019
Getting meta tags from NPR using Cheerio.js
View cheerio_meta.js
const cheerio = require('cheerio');
const request = require('request');
const fs = require('fs');
request({
method: 'GET',
url: 'https://www.npr.org/sections/national/'
}, (err, res, body) => {
if (err) return console.error(err);
@waltir
waltir / cheerio_meta_posts.js
Last active May 2, 2019
Getting meta tags from multiple posts on NPR using Cheerio.js
View cheerio_meta_posts.js
const cheerio = require('cheerio');
const request = require('request');
const fs = require('fs');
var interval = 500;
let data = new Array;
request({
method: 'GET',
url: 'https://www.npr.org/sections/national/'
}, (err, res, body) => {
View all_articles.js
require('events').EventEmitter.defaultMaxListeners = 100;
const cheerio = require('cheerio');
const request = require('request');
const fs = require('fs');
var interval = 500;
let data = new Array;
View articles.js
require('events').EventEmitter.defaultMaxListeners = 100;
const cheerio = require('cheerio');
const request = require('request');
const fs = require('fs');
var interval = 500;
let data = new Array;
@waltir
waltir / script.js
Last active Apr 30, 2019
Cheerio.js Setup
View script.js
require('events').EventEmitter.defaultMaxListeners = 100;
const cheerio = require('cheerio');
const request = require('request');
request({
method: 'GET',
url: 'https://www.npr.org/sections/national/'
}, (err, res, body) => {
if (err) return console.error(err);