Last active
October 14, 2024 10:21
-
-
Save pix0r/6083058 to your computer and use it in GitHub Desktop.
Use wget to scrape all URLs from a sitemap.xml Usage: scrape-sitemap.sh http://domain.com/sitemap.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SITEMAP=$1 | |
if [ "$SITEMAP" = "" ]; then | |
echo "Usage: $0 http://domain.com/sitemap.xml" | |
exit 1 | |
fi | |
XML=`wget -O - --quiet $SITEMAP` | |
URLS=`echo $XML | egrep -o "<loc>[^<>]*</loc>" | sed -e 's:</*loc>::g'` | |
echo $URLS | tr ' ' '\n' | wget -O /dev/null -i - --wait=1 --random-wait -nv |
Thanks for the script!
Wow, just what I was looking for, thanks!
Is there a vise versa? Can I build a sitemap of a website?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot for this bash script! Saved me a lot of head banging 💯