@tpmjs/tools-links-catalog
Extract and categorize all links from web pages into internal, external, and anchor links
Module not found "https://esm.sh/node:sqlite?target=denonext".
at [0m[36mhttps://esm.sh/undici@7.16.0?target=denonext[0m:[0m[33m2[0m:[0m[33m8[0mLast checked: 1/1/2026, 1:05:35 AM
Test @tpmjs/tools-links-catalog (linksCatalogTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-links-catalogpnpm add @tpmjs/tools-links-catalogyarn add @tpmjs/tools-links-catalogbun add @tpmjs/tools-links-catalogdeno add npm:@tpmjs/tools-links-catalogimport { linksCatalogTool } from '@tpmjs/tools-links-catalog';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { linksCatalogTool } from '@tpmjs/tools-links-catalog';
const result = await generateText({
model: openai('gpt-4o'),
tools: { linksCatalogTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
urlstringThe URL to fetch and extract links from
Try to auto-extract schema from the package
Extract and categorize all links from web pages into internal, external, and anchor links.
npm install @tpmjs/tools-links-catalog
import { linksCatalogTool } from '@tpmjs/tools-links-catalog'; const result = await linksCatalogTool.execute({ url: 'https://example.com' }); console.log(result); // { // url: 'https://example.com', // internal: [ // { href: 'https://example.com/about', text: 'About Us' }, // { href: 'https://example.com/contact', text: 'Contact' } // ], // external: [ // { href: 'https://twitter.com/example', text: 'Follow us' } // ], // anchors: [ // { href: '#top', text: 'Back to top' } // ], // total: 4, // metadata: { // fetchedAt: '2025-12-31T12:00:00.000Z', // domain: 'example.com' // } // }
Automatic Categorization: Links are grouped into three categories
Link Deduplication: Automatically removes duplicate links
URL Normalization: Resolves relative URLs to absolute URLs
Metadata Extraction: Captures link text and title attributes
Smart Filtering: Excludes mailto:, tel:, javascript:, and data: URIs
Comprehensive Error Handling: Detailed error messages for network issues
{ url: string; // The URL to fetch and extract links from }
{ url: string; // The fetched URL internal: Link[]; // Links to the same domain external: Link[]; // Links to different domains anchors: Link[]; // Same-page anchor links total: number; // Total number of links metadata: { fetchedAt: string; // ISO timestamp of fetch domain: string; // Domain name extracted from URL }; } interface Link { href: string; // Absolute URL text: string; // Visible link text title?: string; // Optional title attribute }
const result = await linksCatalogTool.execute({ url: 'https://blog.example.com/post' }); console.log(`Total links: ${result.total}`); console.log(`Internal links: ${result.internal.length}`); console.log(`External links: ${result.external.length}`); console.log(`Anchor links: ${result.anchors.length}`); // Find all links to a specific domain const twitterLinks = result.external.filter(link => link.href.includes('twitter.com') ); // Find all internal blog posts const blogPosts = result.internal.filter(link => link.href.includes('/blog/') ); // Check for navigation links const hasNavigation = result.internal.some(link => link.text.toLowerCase().includes('home') || link.text.toLowerCase().includes('about') );
Links that point to the same domain as the source page:
https://example.com/about (from https://example.com)/products (relative URL on same domain)./services (relative URL on same domain)Links that point to a different domain:
https://twitter.com/example (social media)https://partner-site.com (partner website)https://cdn.example.com (different subdomain)Links that navigate within the same page:
#top (jump to top)#section-2 (jump to section)#footer (jump to footer)Note: Subdomains are treated as different domains (e.g., blog.example.com vs example.com).
The tool automatically filters out non-navigational links:
mailto: links (email addresses)tel: links (phone numbers)javascript: links (JavaScript actions)data: links (data URIs)The tool provides detailed error messages for common issues:
All errors include specific details to help diagnose the problem.
fetch API)@tpmjs/tools-page-brief - Extract main content and create summaries@tpmjs/tools-extract-json-ld - Extract JSON-LD structured data@tpmjs/tools-table-extract - Extract HTML tables as structured dataMIT
Downloads/month
0
Quality Score