ShowcaseBrowserAutomationNode.js

Broken Links Checker (Node.js)

A Node.js-based tool that crawls websites to identify broken links using the Universal Sandbox browser environment.

View on GitHubby Universal Sandbox

Installation

Install the required dependencies:

npm install

Usage

Run the script with the target URL:

node linkChecker.js <URL>

Example Output

➜  broken-links-checker-node git:(master) ✗ node linkChecker.js https://ai-infra.org
Starting broken link check for https://ai-infra.org
Starting link check for: https://ai-infra.org
Provider: alibaba
Max pages to check: 50
------------------------------------------------------------
Creating browser sandbox...
✓ Browser sandbox created: 01KCS0VER1P3M20AZ2B666A8GC
Connecting Playwright to sandbox...
✓ Playwright connected
Starting link checking with Playwright...

→ Crawling: https://ai-infra.org
  Found 17 internal links on page
  → Checking: https://ai-infra.org/
    ✓ OK: https://ai-infra.org/
  → Checking: https://ai-infra.org/#features
    ✓ OK: https://ai-infra.org/#features
  → Checking: https://ai-infra.org/#providers
    ✓ OK: https://ai-infra.org/#providers
  → Checking: https://ai-infra.org/#showcase
    ✓ OK: https://ai-infra.org/#showcase
  → Checking: https://ai-infra.org/#pricing
    ✓ OK: https://ai-infra.org/#pricing
  → Checking: https://ai-infra.org/sign-in
    ✓ OK: https://ai-infra.org/sign-in
  → Checking: https://ai-infra.org/sign-up
    ✓ OK: https://ai-infra.org/sign-up
  → Checking: https://ai-infra.org/#examples
    ✓ OK: https://ai-infra.org/#examples
  → Checking: https://ai-infra.org/sdks
    ✓ OK: https://ai-infra.org/sdks
  → Checking: https://ai-infra.org/showcases/broken-links-checker
    ✓ OK: https://ai-infra.org/showcases/broken-links-checker
  → Checking: https://ai-infra.org/showcases/ai-pulse
    ✓ OK: https://ai-infra.org/showcases/ai-pulse
  → Checking: https://ai-infra.org/dashboard?tab=billing
    ✓ OK: https://ai-infra.org/dashboard?tab=billing
  → Checking: https://ai-infra.org/api-docs
    ✓ OK: https://ai-infra.org/api-docs
  Pages checked: 1/50
Link checking completed
Browser connection closed
Sandbox cleaned up successfully
======================================================================
BROKEN LINK CHECK REPORT
======================================================================
Base URL: https://ai-infra.org
Provider: alibaba
Total links checked: 13
Working links: 13
Broken links: 0

No broken links found! ✓
======================================================================
Link checking completed

How It Works

1

Create Browser Sandbox

Uses Universal Sandbox API to spin up a secure browser environment.

2

Crawl & Check Links

Playwright navigates the site and validates each link's status.

3

Generate Report

Outputs a comprehensive report of working and broken links.