#!/usr/bin/env node /** * GitHub Directory Listing Scraper * * Gets directory listings from GitHub without using the API (no rate limits!) * Works by parsing the server-rendered HTML that GitHub sends to browsers. */ async function getGitHubDirectory(owner, repo, path = '') { // Always use the tree URL pattern, even for root directory const url = `https://github.com/${owner}/${repo}/tree/main/${path}`; console.error(`Fetching: ${url}`); const response = await fetch(url); const html = await response.text(); // GitHub embeds the directory data in a JSON script tag // Using the tree (subdirectory) pattern for all cases const subdirMatch = html.match(/