npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-script-runner

v1.4.0

Published

Custom n8n nodes for script execution (jsdom, cheerio) and HTTP requests (axios, fetch)

Downloads

549

Readme

n8n Script Runner Node

A custom n8n node that allows you to run custom JavaScript scripts with jsdom or cheerio for HTML parsing and manipulation.

Features

  • ⚡ Fast HTML parsing with Cheerio (jQuery-like syntax)
  • 🌐 Full DOM implementation with jsdom
  • 🔧 Run custom JavaScript code within n8n workflows
  • 📝 Access to input items and HTML content
  • 🔄 Process multiple items in batch

Installation

Community Node Installation (Recommended)

  1. Go to Settings > Community Nodes in your n8n instance
  2. Select Install
  3. Enter n8n-nodes-script-runner
  4. Agree to the risks and install

Manual Installation

  1. Navigate to your n8n installation folder
  2. Go to custom nodes folder: cd ~/.n8n/custom
  3. Clone or copy this package
  4. Install dependencies: npm install
  5. Build: npm run build
  6. Restart n8n

Usage Examples

Example 1: Extract Text with Cheerio

// Load HTML with cheerio
const $ = cheerio.load(html);

// Extract all headings
const headings = [];
$('h1, h2, h3').each((i, elem) => {
  headings.push($(elem).text());
});

return { headings };

Example 2: DOM Manipulation with jsdom

// Create DOM instance
const dom = new JSDOM(html);
const document = dom.window.document;

// Query and manipulate DOM
const title = document.querySelector('title')?.textContent;
const links = Array.from(document.querySelectorAll('a')).map(a => ({
  text: a.textContent,
  href: a.href
}));

return { title, links };

Example 3: Scrape Table Data

const $ = cheerio.load(html);
const rows = [];

$('table tr').each((i, row) => {
  const cells = [];
  $(row).find('td').each((j, cell) => {
    cells.push($(cell).text().trim());
  });
  if (cells.length > 0) {
    rows.push(cells);
  }
});

return { tableData: rows };

Example 4: Process Input Items

// Access current item
const url = $item.json.url;

// Load HTML from item
const $ = cheerio.load($item.json.html || html);

// Extract data
const title = $('h1').first().text();
const description = $('meta[name="description"]').attr('content');

return {
  url,
  title,
  description,
  processedAt: new Date().toISOString()
};

Available Variables

  • cheerio - Cheerio library (when selected)
  • JSDOM - jsdom constructor (when selected)
  • html - HTML input from the node parameter
  • items - All input items array
  • $item - Current item being processed
  • itemIndex - Index of current item

Parameters

Library

Choose which library to use:

  • Cheerio: Fast, lightweight HTML parser (recommended for most use cases)
  • jsdom: Full DOM implementation (when you need browser-like APIs)
  • Both: Access to both libraries

HTML Input

The HTML content to parse. Can be:

  • Static HTML entered directly
  • Accessed from input items via $item.json.html
  • Left empty if processing from items

Custom Script

Your JavaScript code. Must return a value (object or primitive).

Return Full Items

  • false (default): Returns only script output
  • true: Merges script output with input items

Development

# Install dependencies
npm install

# Build the node
npm run build

# Development mode (watch)
npm run dev

# Format code
npm run format

# Lint
npm run lint

License

MIT

Support

For issues and feature requests, please create an issue in the repository.