A puppeteer script to discover and download all Netflix categories in a JSON file.

robertjgabriel profile image Robert James Gabriel ・2 min read

Netflix has hundreds of hidden categories. How do go about discovering them and finding new ones?

Well, I wrote a puppeteer script. That runs headless chrome, logs into Netflix and goes through each URL, extracts the category title and saves it in a JSON file for you to use.

 * @format
 * @name Netflix
 * @desc Logs into Netflix. Provide your username and password in the config file when running the script, i.e:

const puppeteer = require('puppeteer');
const fs = require('fs');
const config = require('./config.json');

(async () => {
    let results = [];
    const SHOW_LOADING = config.showLoading;
    const browser = await puppeteer.launch({
        headless: config.headless,
    const page = await browser.newPage();

    // Open login page and login
    await page.goto('https://www.netflix.com/ie/login');
    await page.type('#id_userLoginId', config.username);
    await page.type('#id_password', config.password);
    await page.keyboard.press('Enter');
    await page.waitForNavigation();

    // Click the user account
    await page.click('.profile-icon:nth-child(1)');

    // Start going though the urls
    let categoryID = 1; // Count
    let error = 0; // If four errors in a row, end the loop.
    const ERROR_LIMIT = config.errorLimit;

    do {
        await page.goto(`https://www.netflix.com/browse/genre/${categoryID}`);
        let element = await page.$('.genreTitle');

        // If the element exisits
        if (element !== null) {
            let categorieTitle = await (await element.getProperty('textContent')).jsonValue();
            if(SHOW_LOADING) console.log(`.${categoryID} ${categorieTitle}`);

            // Create json object
            let jsonObject = {
                title: categorieTitle,
                id: categoryID,

        // If the element isnt there.
        if (element === null) {

    } while (error <= ERROR_LIMIT);

    fs.writeFile('results.json', JSON.stringify(results), function(err) {
        if (err) throw err;
        console.log('Categories:' + categoryID);

Check out the repo here

You can also follow me on Github and Twitter

Posted on Jan 10 '19 by:

robertjgabriel profile

Robert James Gabriel


Robert James is currently building open source projects and sass products, PWA's across iOS, Android, Website, and TV while traveling the world. To speak at events. Previously at Teamwork, Dell & Emc.


markdown guide