A command-line tool to check HTTP status codes and track redirects.
Github repo: https://github.com/nalmeida/urltracker
URL Tracker helps you analyze HTTP responses and redirects for single URLs or lists of URLs. Perfect for website maintenance, SEO auditing, and link checking.
- Single URL status checking
- Batch URL processing from a txt file
- Redirect chain tracking
- CSV output for further analysis
- Basic authentication support
- Custom headers and cookies
- Verbose mode with detailed curl command display for debugging
Since
v2.0.0urltracker sendsGETas default request method as some servers were returning404status instead of200.
Since
v2.1.0urltracker usesSafari iOS 17.1 User-Agentfor better compatibility with modern web servers and anti-bot protections.
- Bash shell environment
curlcommand-line toolBATS(Bash Automated Testing System) for running tests
brew tap nalmeida/urltracker
brew install urltracker- Clone this repository:
git clone https://github.com/nalmeida/urltracker.git
cd urltracker- Make the script executable:
chmod +x urltracker- (Optional) Create a symlink to use it from anywhere:
sudo ln -s $(pwd)/urltracker /usr/local/bin/urltrackerurltracker https://httpbin.org/status/200Create a text file with one URL per line (e.g.: urls.txt):
https://httpbin.org/status/200
https://httpbin.org/redirect/2
https://httpbin.org/status/404
Then run:
urltracker --list urls.txturltracker --list urls.txt --output results.csvurltracker --auth user:pass https://httpbin.org/basic-auth/user/passurltracker --header "User-Agent: Mozilla/5.0" --header "Accept-Language: en-US" https://httpbin.org/status/200urltracker --method PATCH https://httpbin.org/anything --verboseurltracker https://httpbin.org/redirect/2 --verboseUsage: urltracker [OPTIONS] [URL]
Options:
-h, --help Display this help message
-V, --version Display the version
-l, --list <file> Process a list of URLs from a text file
-o, --output <file> Export results to a CSV file
-v, --verbose Verbose mode: show all redirect URLs
-q, --quiet Quiet mode: no output to console
-nc, --no-color Disable colored output
-m, --method <method> HTTP method to use (default: GET. HEAD is faster but some servers may block it)
-a, --auth <user:password> Use HTTP Basic Authentication
-H, --header <header> Add custom header (can be used multiple times)
-c, --cookie <name=value> Add a cookie (can be used multiple times)
This project uses BATS (Bash Automated Testing System) for testing. To run the tests:
- Install BATS if you don't have it:
# MacOS
brew install bats-core
# Debian/Ubuntu
sudo apt-get install bats- Run the tests:
bats test_urltracker.bats- For verbose test output:
bats --tap test_urltracker.bats- For debug test output:
bats --print-output-on-failure --show-output-of-passing-tests test_urltracker.batsThe test suite covers:
- Basic functionality
- URL list processing
- Output formatting
- Error handling
- Authentication and custom headers
- Command-line option parsing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests for new functionality
- Run the test suite to ensure everything passes (
bats test_urltracker.bats) - Commit your changes (
git commit -am 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- The BATS project for the testing framework
- The command
curl -IL https://httpbin.org/redirect/2that led me to create this project - The amazing httpx as inspiration and a powerful alternative to this humble project
- The amazing vhs CLI demo generator