Skip to content

Instantly share code, notes, and snippets.

@clementgarbay
Last active March 26, 2019 17:11
Show Gist options
  • Save clementgarbay/28f867d7de8d06266dbdcaba568b23a2 to your computer and use it in GitHub Desktop.
Save clementgarbay/28f867d7de8d06266dbdcaba568b23a2 to your computer and use it in GitHub Desktop.
Growth.Dev - Setup Guide

[Growth.Dev] How to transform Linkedin into an address book using Puppeteer!

Prerequisites ๐Ÿ› 

  • A command line terminal, if you're not familiar with it you can read this post explaining the basics. For the best experience, we recommend you iTerm2 an alternative to the pre-install macOS terminal.

  • The JavaScript runtime Node.js. If you're a brew user you can simply brew install node, otherwise you can download it here. Moreover here's an article where you can find more information about how to install it and use it.

To be sure both of these tools are OK, open a terminal and run:

โ–ถ node -v
v10.7.0
โ–ถ npm -v
6.2.0

And check the version of node installed is upper than 8.

First intro with Puppeteer ๐Ÿ

Create a new folder:

โ–ถ mkdir ~/Desktop/puppeteer-setup-test && cd ~/Desktop/puppeteer-setup-test

And install Puppeteer node package:

โ–ถ npm install puppeteer

Create a new script (new file) as an example and save it as example.js. This script will automatically navigate to a website and saving a screenshot of it:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://spendesk.com');
  await page.screenshot({ path: 'spendesk.png' });

  await browser.close();
})();

Execute it:

โ–ถ node example.js

And you will find a new spendesk.png file in your folder with the best website you've ever seen.

That's all for now! You are ready to start scraping all the web ๐Ÿ‘Œ

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