Skip to content

Instantly share code, notes, and snippets.

@phette23
Created September 3, 2026 18:28
Show Gist options
  • Select an option

  • Save phette23/7543797db8e381b833658c6e0690065a to your computer and use it in GitHub Desktop.

Select an option

Save phette23/7543797db8e381b833658c6e0690065a to your computer and use it in GitHub Desktop.
scrape-urls.md

Get all URLS from a website:

  1. Does it have a sitemap.xml? Many CMSes generate these automatically.

  2. Use wget

set DOMAIN example.com
wget --mirror --delete-after --no-directories https://$DOMAIN 2>&1 \
 | grep '^--' | awk '{print $3}' | sort > urls.txt
  1. Use python with BeautifulSoup or scrapy

Mostly iterate over site, look at <a> elements with href, maintain a map of visited pages, only visit particular list of domain(s) so it doesn't follow external links, add a delay in between requests to be polite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment