I’m working with an Airtable base that contains approximately 24,000 website URLs. Many of these links have formatting issues like missing slashes or extra spaces that cause them to break. I need a way to check which URLs are problematic so I can fix them manually.
Current approach
I’ve been using a fetch-based script to test each URL and get the response status:
const config = input.config();
const website = config.website;
let responseCode;
try {
const result = await fetch(website);
responseCode = result.status;
} catch (err) {
responseCode = 'failed';
}
output.set('responseCode', responseCode);
Problems I’m facing
- When a URL redirects to another page, my script treats it as an error instead of following the redirect to check if it ultimately works
- I only get back either “200” for working URLs or “failed” for broken ones. I’d prefer to see the actual HTTP status codes (like 404, 500, etc.) to better understand what’s wrong
Any suggestions on how to improve this approach would be really helpful!