Muffet
repository·main·Indexed 25 days ago
https://github.com/raviqqe/muffetA high-speed website link checker that recursively scrapes and inspects pages for broken links. It supports multiple output formats including text, JSON, and JUnit XML, and can be installed via Go, Homebrew, or Docker. Muffet inspects tags such as <a>, <img>, <link>, and <script>, and provides extensive CLI configuration for rate limiting, connection management, and URL filtering via regular expressions.
What's inside Muffet
- While there is no official GitHub Action provided by Muffet, you can use the third-party GitHub Action My Broken Link Checker to test your static websites using Muffet within your CI workflows.
Install Muffet using Go
mainIf you have the Go programming language installed on your system, you can install Muffet directly using the
go installcommand.go install github.com/raviqqe/muffet/v2@latestRun Muffet using Docker
mainIf your website is hosted remotely or your Docker installation allows you to connect to the host network, you can run Muffet using a Docker image to test your websites. Pass the target URL as an argument to the
docker runcommand.docker run raviqqe/muffet https://shady.bakery.hotlandUse Muffet via Command Line
mainYou can run Muffet directly from your terminal. To see the available commands, flags, and basic usage instructions, execute the command with the
--helpflag.muffet --helpInstall Muffet via Homebrew
mainOn macOS and Linux, you can install Muffet using the Homebrew package manager.
brew install muffetInstall Muffet using Docker
mainYou can pull the official Muffet Docker image to run it in a containerized environment.
docker pull raviqqe/muffetInstall Muffet via Go
mainInstall the latest version of Muffet using the
go installcommand. This will make themuffetbinary available in your$GOPATH/bin.go install github.com/raviqqe/muffet/v2@latestConfigure the docs content collection
mainIn an Astro project using Starlight, define the
docscontent collection by usingdefineCollectionfromastro:content. The collection must use thedocsLoader()from@astrojs/starlight/loadersand thedocsSchema()from@astrojs/starlight/schemato correctly process documentation files.import { defineCollection } from "astro:content"; import { docsLoader } from "@astrojs/starlight/loaders"; import { docsSchema } from "@astrojs/starlight/schema"; export const collections = { docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), };Run Muffet to check website links
mainTo perform a recursive scrape and inspection of all pages in a website, run the
muffetcommand followed by the target URL. Muffet inspects various tags includinga,img,link, andscript.muffet https://shady.bakery.hotlandFind links within HTML nodes using linkFinder
mainThe
linkFindertype provides functionality to traverse an HTML tree and extract URLs from specific attributes (likehref,src,srcset, andcontent). It resolves relative URLs against a provided base URL and uses alinkFiltererto validate the discovered links.To use
linkFinder, you must provide an implementation of thelinkFiltererinterface (which must include anIsValid(*url.URL) boolmethod) vianewLinkFinder.Format page results with pageResultFormatter
mainThe
pageResultFormatteris used to convertpageResultdata into a human-readable string format. It supports colorized output via theauroralibrary and can include detailed success link information ifverbosemode is enabled.To use it, initialize a formatter using
newPageResultFormatter(verbose bool, color bool)and then call theFormat(r *pageResult)method.Execute Muffet commands via the command struct
mainThe
commandstruct is the primary entry point for executing Muffet's crawling and checking logic. You can instantiate it usingnewCommandand trigger the execution by callingRun(args []string).Runreturnstrueif the operation was successful (all checked pages passed) andfalseotherwise. It handles error printing tostderrautomatically.