Skip to content

Instantly share code, notes, and snippets.

Last active November 15, 2017 02:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
await tab.untilVisible("#hnmain") // Make sure we have loaded the page
await tab.inject("") // We're going to use jQuery to scrape
const hackerNewsLinks = await tab.evaluate((arg, callback) => {
// Here we're in the page context. It's like being in your browser's inspector tool
const data = []
$(".athing").each((index, element) => {
title: $(element).find(".storylink").text(),
url: $(element).find(".storylink").attr("href")
callback(null, data)
Copy link

yairEO commented Sep 19, 2017

where do you put this code.. on a runnable Node file?
why would this even open Chrome?

Copy link

@yairEO he's using NickJS. Try something like:

import Nick from "nickjs"

const nick = new Nick()

nick.newTab(async (tab) => { 
	//  Code goes here. 
.then(() => {
.catch((err) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment